LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   start-stop-daemon change needed (https://www.linuxquestions.org/questions/ubuntu-63/start-stop-daemon-change-needed-927580/)

CollieJim 02-04-2012 09:59 AM

start-stop-daemon change needed
 
I'm making a concerted effort to switch from Gentoo to Kubuntu. Mostly things are OK, since I use KDE most of the time. However once I start using the command line, there are some significant differences, even within what appears to be the same program.

The current snag is with start-stop-daemon. The following code works in Gentoo, but fails in Kubuntu.
Code:

#!/bin/sh

### BEGIN INIT INFO
# Provides:          treenav-loop
# Required-Start:    $remote_fs $syslog $all
# Required-Stop:
# Default-Start:    2 3 4 5
# Default-Stop:
# Short-Description: Starts treenav-loop
# Description:      Starts the treenav-loop path navigation program.
### END INIT INFO

set -e
# Must be a valid filename
NAME=treenav-loop
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
TREENAV_TABLE=/data/treenav-loop/table-loop11
DAEMON=/usr/local/bin/treenav-loop\ $TREENAV_TABLE
DAEMONd=/usr/local/bin/treenav-loop\ $TREENAV_TABLE\ $TREENAV_DEBUG
DAEMON_DIR=/data/treenav-loop

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in
  start)
        echo "Starting daemon: "$NAME
        start-stop-daemon --start --quiet --chdir $DAEMON_DIR  --exec $DAEMON
        ;;
  start-debug)
        echo "Starting daemon: "$NAME
        start-stop-daemon --start --quiet --chdir $DAEMON_DIR  --exec $DAEMONd
        ;;
  stop)
        echo "Stopping daemon: "$NAME
        start-stop-daemon --signal SIGUSR1 --quiet  --pidfile $PIDFILE
    sleep 1
        start-stop-daemon --signal SIGINT --quiet  --pidfile $PIDFILE
        ;;
  check)
        echo "Checkpointing daemon: "$NAME
        start-stop-daemon --signal SIGUSR1 --quiet  --pidfile $PIDFILE
        ;;

  *)
        echo "Usage: "$1" {start|stop|check}"
        exit 1
esac

exit 0

From the --help output, I need to change SIGINT to INT, but when I make the changes, and try the 'check' option I get
Code:

start-stop-daemon: need one of --start or --stop
The process is already started and I don't want to stop it.

How does it need to be changed to work in Kubuntu?

Thanks
Jim

eSelix 02-04-2012 11:20 AM

Use --stop. It will just send specified signal. Without --signal it would send TERM.

CollieJim 02-04-2012 08:34 PM

Thanks. It works now.


All times are GMT -5. The time now is 07:18 PM.