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: Alienware, KDE and Ubuntu 13.04
- 2Linux Top 3: Linux Mint Olivia, Fedora 19's Cat and Ubuntu's Mission Accomplished Moment
- 3GNOME 3.8 Debuts New Open Source Linux Desktop
- 4Linux Top 3: Linux 3.10 Goes Long, Linux 3.11 Advances as LXDE Merges
- 5Linux Top 3: Ubuntu Kaylin, Debian Wheezy and Linux Mint