2

This is my code:

#!/bin/bash
daemon="$APPVENV/bin/uwsgi"
args="--emperor $APPCONF/uwsgi/app.ini"
pid="$APPDIR/emperor.pid"
case "\$1" in
    start)
        echo "Starting uwsgi"
        start-stop-daemon -m -p \$pid --start --exec \$daemon -- \$args
        ;;
    stop)
        echo "Stopping script uwsgi"
        start-stop-daemon --signal INT -p \$pid --stop \$daemon -- \$args
        ;;
    reload)
        echo "Reloading conf"
        kill -HUP \$(< \$pid)
        ;;
    *)
        echo "Usage: /etc/init.d/uwsgi {start|stop|reload}"
        exit 1
    ;;
esac
exit 0

When I try to use it, it says I'm missing LSB tags and overrides. I googles it and found this as an example:

### BEGIN INIT INFO
# Provides:          scriptname
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

I'm confused though, about firstly the remote_fs and syslog variables, is this something I need to keep as default? Secondly, how so I know what numbers I should be putting for default start and stop?

1

The $remote_fs (and the $syslog)is used to tell that the script needs the remote file systems must be started before the current script is executed. Unless your script needs it (which seems unlikely) you can remove the $remote_fs part. You should keep the $syslog though. You can also look here to have a better understanding of what you can / should use.

As for the numbers you see, these are the run levels where you script is to be called (either at startup, reboot, or shutdown). Some useful information are available here. The defaults should be fine most of the time.

| improve this answer | |

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.