`start-stop-daemon` is a program used to control the creation and termination of Linux system-level processes (daemons).
start-stop-daemon
is a program used to control the creation and termination of Linux system-level processes (daemons). Using one of the matching options, start-stop-daemon
can be configured to find existing instances of a running process.
The man page specifies below note:
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.
Usage sample:
start-stop-daemon --start --background -m --pidfile ${PIDFILE} --exec ${DAEMON} -- ${TARGETDIR}
Command arguments explanation:
--start
: Check for an instance of the specified process and start it (if not already started).--background
: the daemon is launched as a background process.-m
: make a PID file. This is used when your process doesn't create its own PID file, and is used with--background
.--pidfile ${PIDFILE}
: check if the PID file has been created or not.--exec
: make sure the processes are instances of this executable (in this case, DAEMON)
For more informations and more options, check the man page.