This is a list of stanzas that can be used in a job file, how can it be used (syntax, arguments) and why using it (what it does, with an example)
exec
Syntax: exec ''command'' ''arguments...''
Example: exec /usr/bin/dbus-daemon --system
Description: Execute the following arguments as a command in "start" action.
script
Syntax:
script ''some shell scripting'' end script
Example (although you may use pre-start for doing that ;)):
script rm -f /usr/share/hal/fdi/policy/gparted-disable-automount.fdi /usr/sbin/hald end script
Description: Roughly equivalent to exec, but executes a script instead of a command. Can't be used together with exec, exec has priority.
pre-start
Syntax 1: pre-start exec ''command'' ''arguments...''
Example 1: pre-start exec rm -f /usr/share/hal/fdi/policy/gparted-disable-automount.fdi
Syntax 2:
pre-start script ''some shell script'' end script
Example 2:
pre-start script start dbus rm -f /usr/share/hal/fdi/policy/gparted-disable-automount.fdi end script
Description: execute the command/script before actually running the process
post-start
Same as pre-start, but after
pre-stop
Let's guess
post-stop
cf pre-stop
start
Syntax: start on ''events...''
Example: start on startup
Description: say when to start the job
stop
Syntax: stop on ''events...''
Example: stop on stopping dbus ok
Description: say when to stop the job
description
Syntax: description ''text''
Example: description "DBus is a message bus system, a simple way for applications to talk to each other."
Informal only.
Description: Description of the job.
author
Syntax: author ''author''
Example: author "Obi-wan Kennedy <bidy@whitehouse.gov>"
Informal only
Description: Author of the job file.
version
Syntax: version ''version''
Example: version "0.0.0.0.1 test"
Informal only
Description: Version of the job file.
emits
Syntax: emits ''signals...''
Example: emits spam egg ham
Informal only
Description: Signals that can be emitted by this job.
daemon
Syntax/Example: daemon
Description: Sets the daemon flag for the job. This means that the job will fork in the background and that its PID need to be obtained.
respawn
Syntax/Example 1: respawn
Description: this sets the daemon, service, and respawn flags for the job. The respawn flag means that the process will be restarted if ended unexpectedly.
Syntax 2: respawn limit ''[count [timeout]]''
Example 2: respawn limit 15
Description 2: This configures the respawn limits, which only apply if the respawn flag is set (a separate syntax 1 respawn command must be present to actually set the respawn flag, as of version 0.3.8). The respawn limits function as follows: If the process is respawned more than count times within an interval of timeout seconds, the process will be stopped automatically, and not restarted. Unless set explicitly, the limit defaults to 10 times within 5 seconds.
service
Implied by respawn
Syntax/Example: service
Description: this mean that the job has reached its goal when running
instance
Syntax/Example: instance
Description: Job is always waiting and just spawn instances
pid
Sets how to know the PID of a daemon (as of 0.3.8, not implemented, just silently ignored)
Syntax 1: pid file ''pid_file''
Example 1: pid file /var/run/dbus.pid
Description: identify daemon by pid file
Syntax 2: pid binary ''path_to_binary''
Example 2: pid binary /usr/bin/dbus-daemon
Description: identify daemon by executable
Syntax 3: pid timeout ''time''
Description: set amount of time before giving up on obtaining a pid
kill
Syntax: kill timeout ''time''
Example: kill timeout 5
time to wait between sending TERM and KILL signals
normal
Syntax: normal exit ''status...''
Example: normal exit 0
List exit codes that prevents a respawn
console
Syntax: console {logged|output|owner|none}
Example: console owner
Descripition: set what to do with process console
logged: redirect to logger (the default setting)
output: direct output to current stdout
owner: the process become the owner of the console, that means it can receive signals from keyboard
none: output is redirected to /dev/null
env
Syntax: env ''name''=''value''
Example: env PIDFILE=/var/run/myprocess.pid
Description: set an environnement variable of the process
umask
Syntax: umask ''an_umask''
Example: umask 0755
Description: set the umask file creation of the process
nice
Syntax: nice ''niceness''
Example: nice 5
Description: set the niceness of the process
limit
* Syntax: limit as|core|cpu|data|fsize|memlock|msgqueue|nice|nofile|nproc|rss|rtprio|sigpending|stack unlimited|''max_resource'' * Example: limit nproc 10 * Description: set service limits
chroot
Syntax: chroot ''path''
Example: chroot /var/lib/www/jail
Description: chroot the process to path
chdir
Syntax: chdir ''path''
Example: chdir /var/tmp
Description: set the working directory of the process
-- CategoryDoc