3

I want to start a watchdog kicker on startup but am unsure how to name and where to place my upstart script.

start on startup
respawn
script
  /usr/sbin/watchdog
end script

Reference: http://upstart.ubuntu.com/cookbook/

I'm also just trying to understand the difference between sysVinit, init.d, rc.local, upstart (latest and greatest?).

What is the reason for what seems to be so many ways to do the same thing, for example:

service watchdog start 
/etc/init.d/watchdog start
/usr/sbin/watchdog
  • For the record, upstart is not the latest and greatest; it's systemd. Debian 8 and Ubuntu 15.04 default to systemd. In addition, upstart scripts are not recognized by systemd, whereas init.d scripts are. – saiarcot895 Jul 18 '15 at 2:00
2

Upstart system jobs have a .conf extension and are placed in /etc/init. So, you can create /etc/init/watchdog.conf containing those lines, and you should have a working Upstart service definition.

  1. service watchdog start: The service command is generally a script which picks the right init service to use (i.e, whether to run Upstart commands or scripts in /etc/init.d, or call systemctl if systemd is being used).
  2. /etc/init.d/watchdog start is calling the System V init script directly. Not what you want to do if you're going to use an Upstart job for this.
  3. /usr/sbin/watchdog just runs the binary directly. Unless the program daemonizes, this (IMHO) is only useful for debugging. You lose the monitoring and control facility from init scripts if it daemonizes, and Upstart's respawning capability.

(2) exists because people generally want a structured, controllable way of starting services, which (3) doesn't offer. (1) exists because (2) doesn't offer enough (which is why Upstart, systemd, OpenRC, etc., were made).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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