Controlling Ubuntu's and Fedora's Upstart (the init replacement) - page 2
Controlling Startup Events
You can also set scripts to run before and after the start of a job:
pre-start exec echo "Starting jobname"
echo "Started jobname"
pre-stop and post-stop work in exactly the same way.
To choose where the output should go, use the console stanza.
sends the output to /dev/console, while none sends it to /dev/null. The default is logged which sends it to the logger; you can also set it to owner, in which case the process becomes the owner of the console and can receive input from the keyboard.
As in the runlevel 3 script above, you can start on particular runlevels, on the startup event, or in response to another job, e.g.
start on started cupsd
would start this service when cupsd starts. If you want to start or stop a service manually, you can use the start and stop commands (usually found in /sbin/):
You can also get the status of a job with status servicename.
Finally, you can list all jobs with initctl list, and emit a custom event with initctl emit eventname. So if we have a job which runs after a ping event:
exec echo "ping"
it can be run with initctl emit ping, and the console will show this output:
There are various further improvements planned to upstart, including a scheduler so that events can be generated at specific intervals or at particular times, and the ability to react to an event caused by the change of a file or directory. There's development information available if you're interested in following or helping out with the development. The Upstart wiki may also be helpful for both users and developers.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 2Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative
- 3Linux Top 3: Fedora, Ubuntu and Gluster Lose Community Leaders
- 4Red Hat Enterprise Linux 7 Finally Hits the Big Time
- 5Linux Top 3: Tails 1.0, OpenMandriva Lx 2014.0 and Debian 7.5