Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 12107  / 3 Years ago, tue, november 2, 2021, 10:05:22

I have a very small upstart job in /etc/init/tsm.conf to start backup client after network starts. It works just ok if I start/stop it manually via service tsm start|stop|status. But service tsm enable says tsm: unrecognized service. So it doesn't start on boot automatically. sudo service --status-all also doesn't show it in the list of known jobs.



Here it is:



start on started networking
stop on stopped networking

respawn

script
#!/bin/bash
dsmc schedule > /dev/null
end script


I run ubuntu 12.04.4. Upstart version is 1.5-0ubuntu7.2.
Could anybody help me? :)



UPDATE



Using initctl list and other initctl commands shows my job.


More From » 12.04

 Answers
2

As of my experience you don't have to "enable" anything, just put the .conf in /etc/init and enjoy.



You can verify that the script does run by adding a line like this in the script:



echo "alive" > /alive_and_well


This will create file "alive_and_well" in your root dir if the script runs.



If it doesn't, the problem is most likely in the "start on" stanza. Here's what I use for such things (known to work):



start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]


Also shebangs in Upstart scripts are not supported, so "#!/bin/bash" is useless (AFAIK).


[#27312] Wednesday, November 3, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
urvedcaly

Total Points: 171
Total Questions: 118
Total Answers: 124

Location: Cape Verde
Member since Fri, Nov 27, 2020
4 Years ago
urvedcaly questions
Tue, Nov 8, 22, 19:40, 2 Years ago
Fri, May 26, 23, 15:27, 1 Year ago
Wed, Jan 19, 22, 08:09, 2 Years ago
Thu, May 13, 21, 03:34, 3 Years ago
;