Note: unless --pidfile is specified, start-stop-daemon behaves similar to killall(1). start-stop-daemon will scan the process table looking for any processes which match the process name, uid, and/or gid (if specified). Any matching process will prevent --start from starting the daemon. All matching processes will be sent the TERM signal (or the one specified via --signal or --retry) if --stop is specified. For daemons which have long-lived children which need to live through a --stop, you must specify a pidfile.
If timeout is specified instead of schedule, then the schedule signal/timeout/KILL/timeout is used, where signal is the signal specified with --signal.
schedule is a list of at least two items separated by slashes (/); each item may be -signal-number or [-]signal-name, which means to send that signal, or timeout, which means to wait that many seconds for processes to exit, or forever, which means to repeat the rest of the schedule forever if necessary.
If the end of the schedule is reached and forever is not specified, then start-stop-daemon exits with error status 2. If a schedule is specified, then any signal specified with --signal is ignored.
start-stop-daemon --start --oknodo --user food --name food --pidfile /var/run/food.pid --startas /usr/sbin/food --chuid food -- --daemon
Send SIGTERM to food and wait up to 5 seconds for it to stop:
start-stop-daemon --stop --oknodo --user food --name food --pidfile /var/run/food.pid --retry 5
Demonstration of a custom schedule for stopping food:
start-stop-daemon --stop --oknodo --user food --name food --pidfile /var/run/food.pid --retry=TERM/30/KILL/5
Manual page by Klee Dienes <klee@mit.edu>, partially reformatted by Ian Jackson.