|内容||To create a job to be started automatically when Ubuntu starts, use the example given here. As written example, suppose to create the following file /etc/init/testservice.conf with sudo:|
# testservice - test service job file
description "my service description"
author "Me <email@example.com>"
# Stanzas control when and how a process is started and stopped
# See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas
# When to start the service
start on runlevel 
# When to stop the service
stop on runlevel 
# Automatically restart process if crashed
# Essentially lets upstart know the process will detach itself to the background
# This option does not seem to be of great importance, so it does not need to be set.
# Specify working directory
# Specify the process/command to start, e.g.
exec python mycommand.py arg1 arg2
To 'manually' start or stop the process use
sudo start testservice
sudo stop testservice