Mar 27, 2011

Booting the system with Upstart (II)

root@ubuntu-server:~# cat /etc/init/job1.conf
# Start when the loading modules have concluded
start on stopped load-modules
# Start when the filesystem is mounted
start on filesystem
# Start when the filesystem is mounted and the network is started
start on filesystem and started network
# Start under the runlevels 2, 3 and 5
start on runlevel [235]
...

The initctl utility allows to pass down a concrete event.

root@ubuntu-server:~# initctl emit myevent

If we take a look at the files dropped off within the /etc/init directory, we will be able to find out many other events. For instance, if we open the mountall.conf file, we can see that this job mounts the filesystems during the boot and emits events as local-filesystems, all-swaps, etc.

All the theory described for "start on", also can be applied when we want to stop a job.

Another interesting configuration option is the respawn tag, which is utilized to start automatically a job if it stops abnormally. We can also set that if a job is respawned more that X times in Y seconds, it will be stopped definitely.

Subscribe to

Follow by Email

About the author...

Javier Andrés Alonso has got a Master's Degree in Telecommunication Engineering and a Bachelor's Degree in Telecommunication Technical Engineering (specialising in Telematics), from the Polytechnic School of the University of Alcalá de Henares.