Changes between Version 2 and Version 3 of InitdScriptForDebian


Ignore:
Timestamp:
Jul 28, 2009, 7:51:49 AM (15 years ago)
Author:
Sebastian Rahlf
Comment:

Single sites can now be started/stopped individually. There is also a status action now.

Legend:

Unmodified
Added
Removed
Modified
  • InitdScriptForDebian

    v2 v3  
    3333#          Joost Cassee
    3434#          <joost@cassee.net>
     35#          Sebastian Rahlf
     36#          <basti AT redtoad.de>
    3537#
    36 # Version: @(#)fastcgi 0.3 05-Aug-2008 joost AT cassee.net
     38# Version: @(#)fastcgi 0.4 28-Jul-2009 basti AT redtoad.de
    3739#
    3840
     
    7274chown -R $RUN_AS:$RUN_AS $RUNFILES_PATH
    7375
     76# A specific site can be started/stopped by appending its name
     77SITE=$2
     78if [ -n "$SITE" ]; then
     79    DJANGO_SITES=$SITE
     80fi
     81
    7482#
    7583#       Function that starts the daemon/service.
     
    8189    for SITE in $DJANGO_SITES
    8290    do
    83         echo -n ", $SITE"
     91        echo -n " $SITE"
    8492        if [ -f $RUNFILES_PATH/$SITE.pid ]; then
    8593            echo -n " already running"
     
    105113    for SITE in $DJANGO_SITES
    106114    do
    107         echo -n ", $SITE"
     115        echo -n " $SITE"
    108116        start-stop-daemon --stop --quiet --pidfile $RUNFILES_PATH/$SITE.pid \
    109117                          || echo -n " not running"
     
    118126case "$ACTION" in
    119127    start)
    120         echo -n "Starting $DESC: $NAME"
     128        echo -n "Starting $DESC:"
    121129        d_start
    122130        echo "."
     
    124132
    125133    stop)
    126         echo -n "Stopping $DESC: $NAME"
     134        echo -n "Stopping $DESC:"
    127135        d_stop
    128136        echo "."
     137        ;;
     138
     139    status)
     140        echo "Status of $DESC:"
     141        for SITE in $DJANGO_SITES
     142        do
     143            echo -n "  $SITE"
     144            if [ -f $RUNFILES_PATH/$SITE.pid ]; then
     145                echo " running ($(cat $RUNFILES_PATH/$SITE.pid))"
     146            else
     147                echo " not running"
     148            fi
     149        done
    129150        ;;
    130151
     
    138159
    139160    *)
    140         echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
     161        echo "Usage: $NAME {start|stop|restart|force-reload|status} [site]" >&2
    141162        exit 3
    142163        ;;
Back to Top