Upstart

From Leaky
Revision as of 16:50, 18 January 2015 by Leaky (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

upstart is different to the old init process, but seems a lot more powerful as you can catch more events than just changing runlevels. Create a config file /etc/init/monitor_bw.conf

# Upstart implementation to spawn and run monitor_bw.pl
description    "Manage the monitor_bw.pl script"
start on startup
start on runlevel [2345]
stop on runlevel [016]
respawn

exec /usr/local/sbin/init.monitor_bw.pl

To run as a particular user (with the CentOS 6 version of upstart):

exec su -c "/usr/local/sbin/init.monitor_bw.pl" otheruser

To get the config to be executed, simply do:

initctl start monitor_bw

To stop it nicely:

initctl stop monitor_bw

To view the upstart managed services:

initctl list