[uWSGI] Init script for Debian?

Tim Tisdall tisdall at gmail.com
Wed Apr 23 17:05:49 CEST 2014


Here's what I use on debian (not upstart.  it's an executable in
/etc/init.d/):

#! /bin/bash
### BEGIN INIT INFO
# Provides:          uwsgi_metrics_dev
# Required-Start:    $local_fs $remote_fs $networking
# Required-Stop:     $local_fs $remote_fs $networking
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts uwsgi_metrics_dev
# Description:       Starts and stops uwsgi_metrics_dev as needed
### END INIT INFO
# /etc/init.d/uwsgi_metrics_dev
#

daemon=/sites/metrics_dev/env/bin/uwsgi
pid=/var/run/uwsgi/metrics_dev.pid
args="--ini /sites/metrics_dev/development_uwsgi.ini --ini-paste
/sites/metrics_dev/development.ini"

# Carry out specific functions when asked to by the system
case "$1" in
    start)
        echo "Starting uwsgi_metrics_dev"
        start-stop-daemon -p $pid --start --exec $daemon -- $args
        ;;
    stop)
        echo "Stopping script uwsgi_metrics_dev"
        start-stop-daemon --signal QUIT -p $pid --stop $daemon -- $args
        ;;
    reload | restart)
        echo "Restarting worker threads"
        kill -HUP $(cat $pid)
        ;;
    *)
        echo "Usage: /etc/init.d/uwsgi_metrics_dev {start|stop|reload}"
        exit 1
    ;;
esac

exit 0



On Wed, Apr 23, 2014 at 10:25 AM, Gilles <codecomplete at free.fr> wrote:

> Hello
>
> Before asking, I checked the archives with either "debian upstrat" or
> "debian init" but didn't find much:
> http://dir.gmane.org/gmane.comp.python.wsgi.uwsgi.general
>
> What is the right way to write an Upstart script to start/stop uwsgi
> on a Debian host, where the settings should be in an INI file instead?
>
> Thank you.
>
> Here's the sample from the online documentation:
> ================
> # simple uWSGI script to start uwsgi as stand-alone web server
>
> description "uwsgi tiny instance"
> start on runlevel [2345]
> stop on runlevel [06]
>
> #Where to put myapp.ini?
> exec uwsgi myapp.ini
> ================
> http://uwsgi-docs.readthedocs.org/en/latest/Upstart.html
>
> 1. Is it indeed possible to outsource settings in an INI file?
>
> 2. If yes, where should the INI file be located for Upstart to find
> it?
>
> Thank you.
>
> _______________________________________________
> uWSGI mailing list
> uWSGI at lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.unbit.it/pipermail/uwsgi/attachments/20140423/551c0888/attachment-0001.html>


More information about the uWSGI mailing list