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


dsmc schedule > /dev/null
end script

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


Using initctl list and other initctl commands shows my job.

  • Did you put start-stop script int /etc/init.d? – c0rp Jan 24 '14 at 9:42
  • No, I put it into /etc/init. Should I symlink from /etc/init.d ? – Alexander Jan 24 '14 at 9:46
  • It seems like /etc/init.d is used by other "old-style" init system. Or?... – Alexander Jan 24 '14 at 9:48
  • Hmm, may be. I will read about it. I'm still using init.d daemons. If I find some interesting information I will write you – c0rp Jan 24 '14 at 9:53
  • 1
    Sorry to mislead. Thanks for your question – c0rp Jan 24 '14 at 10:13
up vote 3 down vote accepted

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).

  • 1
    Thanks! The problem was in start on. I've taken one from mysql.conf with explicit runlevel instead of networking and it works. – Alexander Jan 24 '14 at 10:17

Take a look at the other upstart jobs listed in /etc/init.d/. On my system, they are all symlinks to /lib/init/upstart-job, which makes the service command work (I'm running Saucy).

Try creating the same symlink if you want the service command to work.

Otherwise, use start, stop and restart directly.

  • /etc/init.d/ is for sysvinit compatibility, the actual jobs reside in /etc/init/ – Shnatsel Jan 24 '14 at 10:02
  • Indeed; and the service command that the question used requires this sysvinit compatibility to be in place for the job he created. If you care to look, you'll find that all other system-provided upstart jobs have one. – Robie Basak Jan 24 '14 at 10:40

It sounds like the service is running but you're not seeing the behavior you expect from it. If it needs to run as a certain user or with environment variables set then you may need to specify those. Make sure the dsmc command is in your PATH, or change to the directory where it resides.

From the Upstart Cookbook: http://upstart.ubuntu.com/cookbook/

Environment variables: Upstart allows you to set environment variables which will be accessible to the jobs whose job configuration files they are defined in. Environment variables are set using the env keyword.

env ENV_VAR=value

Set Group Id: Changes to the group before running the job's process.

setgid <groupname>

Set User Id: Changes to the user before running the job's process.

setuid <username>

Change directory: Runs the job's processes with a working directory in the specified directory instead of the root of the filesystem.

chdir <directory>

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.