0

I'm new to debian and I'm currently really struggling to make a script execute at startup. I've tried cron and update-rc.d but neither worked for me. So I'm now trying to work with rc.local. In there I've put:

#!/bin/sh -e
# This script is executed at the end of each multiuser runlevel

/etc/init.d/red5-2

exit 0

When I execute the rc.local it needs {start|restart|stop} and I don't have a clue what to do next. I will be really grateful if someone can check the red5-2 code and tell me what I can change so it's executable on startup. I'm putting the red5-2 code below:

#
#!/bin/sh -e
#
# Startup script for Red5
# Modified by Alvaro Bustos



export RED5_HOME=/opt/red54010

start_red5="$RED5_HOME/red5.sh start"
stop_red5="$RED5_HOME/red5-shutdown.sh stop"

start() {
        echo -n "Starting Red5: "
        ${start_red5} &
        echo "done."
}
stop() {
        echo -n "Shutting down Red5"
        echo -n " "
        su -s /bin/bash -c "killall -q -u $RED5_USER java" $RED5_USER
        su -s /bin/bash -c "killall -9 java"
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        sleep 10
        start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
esac

exit 0
  • So you're wrapping a script, with start and stop verbs and Poor Man's Dæmon Supervision written badly in shell script, inside another script, a van Smoorenburg rc script with start and stop verbs, trying to run it from a mechanism that is a double backwards compatibility mechanism, on a systemd operating system. And, as is so often the case in the systemd House of Horror, it's all to set a few environment variables and run Java with a jar file. What on Earth posesses people to do this, especially when the installation manual for the software supplies a proper systemd service? – JdeBP May 11 at 8:44

Your Answer

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

Browse other questions tagged or ask your own question.