30

I have all of my upstart config files under version control. My ideal way to use upstart is to create soft links from my version control repository (mercurial - not that it matters) into /etc/init but upstart fails to see the jobs. Everything is fine if I copy the files from the repository directory to /etc/init.

Anyone know why upstart fails to handle symbolic or even hard links?

Thanks

Chris

Chris McCauley
  • 552
  • 1
  • 5
  • 15
  • 1
    Perhaps it was a design decision on the part of the Upstart developers to ignore soft links? Anyway, if your repository is on the same partition as `/etc/init`, try using hard links. – Steven Monday Oct 20 '10 at 18:06
  • Tried hard links and that didn't work either :-( – Chris McCauley Oct 20 '10 at 18:25
  • Lame. Indeed symlinks are ignored without a manual call to reload config. Sigh. I prefer symlinks. Cleaner in my use-case. Oh well. I'll just copy the files in, like jerk. – James T Snell Jan 03 '14 at 04:55

3 Answers3

49

Upstart watches its configuration directories with inotify and reloads the configuration when any of the files change or a new file is added. Apparently this doesn't work for symlinks.

To manually update the configuration use

$ initctl reload-configuration
Fabian Jakobs
  • 764
  • 9
  • 11
  • this used to work reliably for me. lately on upstart 1.3 it only works on jobs that are stopped. – jcomeau_ictx Dec 18 '14 at 23:15
  • 2
    For me symlinks in /etc/init/ work but if I change the file behind the symlink the file is not re-read by the upstart tools. It took me hours to find out that the symlink is the reason. It acts like a cache that nobody wants to have. – peschü May 20 '15 at 14:44
9

Upstart does not support symlinks because they might point to a file on a partition that is not loaded at boot time.

I have gotten around this in my own project by putting the conf files in /etc/init/myscripts and then binding that to a directory in my repository. mount --bind /etc/init/myscripts ~/code/repo/initscripts.

Add this to /etc/fstab and the binding will be persistent:

/etc/init/myscripts  /home/me/code/repo/initscripts      none    bind

This effectively gives you hard-linked directories. Upstart will treat the conf files as any other, because they are local to /etc/init. Your DVCS will also see them as local files in the repo, so it will also treat them as it would any other files stored there. Best of both worlds.

1

As mentioned before:

initctl reload-configuration

However if you get an error like the following:

initctl: Rejected send message, 1 matched rules; type="method_call", sender=":1.155" (uid=1000 pid=6177 comm="initctl reload-configuration ") interface="com.ubuntu.Upstart0_6" member="ReloadConfiguration" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")

You must invoke the sudo:

sudo initctl reload-configuration
Karl Morrison
  • 1,521
  • 4
  • 25
  • 42