0

I made an init.d script that don't stop properly the service i run:

start() {
    echo "Starting Server"
    rm -f $LOGFILE
    start-stop-daemon --start --background --chuid $USER:$GROUP --pidfile $PIDFILE --make-pidfile --chdir $PATH --startas /bin/bash -- -c "exec $BIN -f $CONFIG | gawk -E $FILTER > $LOGFILE"
}

stop() {
    echo "Stopping Server"
    start-stop-daemon --stop --quiet --pidfile $PIDFILE
}

starting the service create a process tree and stop() kills only the shell and not the main process $BIN I tried a lot of things like making a wrapper script etc and still the same problem.. i need to use PID because i want to lanch multiple instances of the service

Anyone knows the proper way ? Thanks

2
  • Which version of Debian? If it is 8, you should use systemd, not sysv init scripts.
    – muru
    Nov 9, 2015 at 23:09
  • Debian 7 (Wheezy) (64 bits)
    – Gwilh
    Nov 10, 2015 at 8:58

1 Answer 1

-1

Your service should create pidfile for daemon to kill. The --make-pidfile option shoud be removed

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .