Creating your own Upstart script
One of the best ways in which you can learn about these services is to create your own configuration file containing the Upstart script and all the associated conditions for our service. The configuration file will require the extension of .conf
and has to be created in the /etc/init
directory. For the purpose of this demonstration, we will create a simple service with the well-researched and inventive name: sample
.
Using the text editor vi to create the /etc/init/sample.conf
file, the service begins to take shape:
#/etc/init/sample.conf description "Simple demonstration upstart script" author "The Urban Penguin" start on runlevel [35] script logger -p local1.info "Starting upstart service" end script
The service itself does nothing other than use the logger program to write to the syslog daemon; we can read the output from the /var/log/messages
logfile. You, of course, could adjust the service to do more; however, this acts as a great start in demonstrating...