/etc/init.d

Chris Angelico rosuav at gmail.com
Thu Jan 6 21:48:35 UTC 2011


On Fri, Jan 7, 2011 at 8:41 AM, Tom H <tomh0665 at gmail.com> wrote:
> If you'd like to do it "properly" (and be able to stop/start/restart
> the app with service or a similar tool), you can either:
>
> . create a sysvinit script in "/etc/init.d" and run, for example,
> "update-rc.d yourscript start 30 2 3 4 5 . stop 70 0 1 6 ." making
> sure that no app on which yours depends starts at 30 or higher.
>
> . create an upstart script in "/etc/init".

If you have upstart (as all recent versions of Ubuntu do), I strongly
recommend the latter. In my workplace we had a set of tasks which had
to start at particular times in the boot process, and creating an
upstart job for each one was way easier than trying to juggle the
numbers. If you go with /etc/init.d and then later find that you need
more control, it's fiddly to go and change it to upstart; if you go
with upstart, you'll probably just change the event that it fires on.

Unfortunately reference material for upstart is rather scantier than
for sysvinit. There's plenty of third-party examples of /etc/init.d
scripts, not so much for /etc/init, I guess a consequence of Upstart
being newer (it is, I suppose, a young upstart).

Chris Angelico




More information about the ubuntu-users mailing list