LSBized Init Script stops after aprox. 4minutes

92 views Asked by At

I have made an LSBized Init Script, that runs some script at boot, and than restarts the script if it has been killed or closed.

At first everything looks fine, but after few minutes the init script stops, the other script keeps running.

I get this error in /var/log/syslog

Jun  9 14:53:49 debian systemd[1]: test.service start operation timed out. Terminating.
Jun  9 14:53:49 debian systemd[1]: Failed to start LSB: Start some script on boot and restarts it if it stops..
Jun  9 14:53:49 debian systemd[1]: Unit test.service entered failed state.

My script looks like this:

#! /bin/sh
# /etc/init.d/test
#

### BEGIN INIT INFO
# Provides:          $parentscript
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start some script on boot and restarts it if it stops.
# Description:       Start some script on boot and restarts it if it stops.
### END INIT INFO

start() {
until /home/user/runthis; do
    echo "Process crashed with exit code $?.  Respawning.." >&2
    sleep 1
done

}


# Carry out specific functions when asked to by the system
case "$1" in
  start)
        start
        ;;
  stop)
        echo "Stopping script test"            
        ;;
  *)
        echo "Usage: /etc/init.d/test {start|stop}"
        exit 1
        ;;
esac

exit 0

I tried on Debian 8.0 x64 and x86, same thing happens in both cases.

Is there something I am doing wrong? Or is there any other way to achieve the same result? Thanks!

0

There are 0 answers