/etc/init.d/example:
--------------------

#!/bin/sh

### BEGIN INIT INFO
# Provides:          example
# Required-Start:    $local_fs $remote_fs $network $syslog $nginx $postgresql
# Required-Stop:     $local_fs $remote_fs $network $syslog $nginx $postgresql
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the example application
# Description:       starts example using supervisor
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=example
DESC=example
PYVENV=/var/pyvenv

set -e

. /lib/lsb/init-functions

case "$1" in
    start)
        echo -n "Starting $DESC: "
        if [ -z "$(pgrep supervisord)" ]
            then
                . $PYVENV/bin/activate && supervisord -c $PYVENV/$NAME/supervisor.conf
            else
                . $PYVENV/bin/activate && supervisorctl -c $PYVENV/$NAME/supervisor.conf start $NAME
        fi
        echo "$NAME."
        ;;

    stop)
        echo -n "Stopping $DESC: "
        . $PYVENV/bin/activate && supervisorctl -c $PYVENV/$NAME/supervisor.conf stop $NAME
        echo "$NAME."
        ;;

    restart|force-reload)
        echo -n "Restarting $DESC: "
        . $PYVENV/bin/activate && supervisorctl -c $PYVENV/$NAME/supervisor.conf restart $NAME
        echo "$NAME."
        ;;

    status)
        . $PYVENV/bin/activate && supervisorctl -c $PYVENV/$NAME/supervisor.conf status $NAME
        ;;
    *)
        echo "Usage: $NAME {start|stop|restart}" >&2
        exit 1
        ;;
esac

exit 0