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

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.