I am using a start-stop-daemon to make a INIT script for my script. I am using --make-pidfile cause my script doesnt make its own pid. I can start my script using start and pid file generates with appropriate PID. But the stop function doesnt work. As per start-stop-daemon manual,
--stop Checks for the existence of a specified process. If such a process exists, start-stop-daemon sends it the signal specified by --signal, and exits with error status 0. If such a process does not exist, start-stop-daemon exits with error status 1 (0 if --oknodo is specified). If --retry is specified, then start-stop-daemon will check that the process(es) have terminated.
I didnt find find any documentation for --signal itself. Like how to specify --signal if I want to send a SIGTERM.
case "$1" in
start|debug)
log_daemon_msg "Starting $DESC: $NAME"
start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE \
--exec $DAEMON || log_failure_msg " already running"
log_end_msg 0
;;
stop)
log_daemon_msg "Stopping $DESC: $NAME"
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
--exec $DAEMON
log_end_msg 0
;;