Advertisement
lucianoes

spawn-fcgi perl

Sep 26th, 2011
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.76 KB | None | 0 0
  1. #!/bin/bash                                                                                            
  2. #2011 - Luciano Silva lucianoes@ufrgs.br
  3. #Bash Script for start stop service spawn-fcgi with perl request tracker
  4. ### BEGIN INIT INFO
  5. # Provides:          spawn-fcgi
  6. # Required-Start:    $all      
  7. # Required-Stop:     $all      
  8. # Default-Start:     2 3 4 5  
  9. # Default-Stop:      0 1 6    
  10. # Short-Description: starts FastCGI for PHP
  11. # Description:       starts FastCGI for PHP using start-stop-daemon
  12. ### END INIT INFO                                                  
  13.  
  14. USER=www-data
  15. GROUP=www-data
  16. CHILDREN=6
  17. HOST=127.0.0.1
  18. PORT=9000
  19.  
  20. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  21. NAME=spawn-fcgi-perl                                                  
  22. PID=/var/run/spawn-fcgi.pid                                      
  23. DAEMON=/usr/bin/spawn-fcgi
  24. DAEMON_OPTS="-f /opt/rt4/sbin/rt-server.fcgi -a $HOST -p $PORT -C $CHILDREN -u $USER -g $GROUP -P $PID"
  25.  
  26.  
  27. test -x $DAEMON || exit 0
  28.  
  29. set -e
  30.  
  31. case "$1" in
  32.   start)
  33.         echo "Starting $NAME: "
  34.         start-stop-daemon --start --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS
  35.         echo "done."
  36.         ;;
  37.   stop)
  38.         echo "Stopping $NAME: "
  39.         start-stop-daemon --stop  --pidfile $PID --retry 5
  40.         rm -f $PID
  41.         echo "done."
  42.         ;;
  43.   restart)
  44.         echo "Stopping $NAME: "
  45.         start-stop-daemon --stop  --pidfile $PID --retry 5
  46.         rm -f $PID
  47.         echo "done..."
  48.         sleep 1
  49.         echo "Starting $NAME: "
  50.         start-stop-daemon --start --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS
  51.         echo "done."
  52.         ;;
  53.   *)
  54.         echo "Usage: /etc/init.d/$NAME {start|stop|restart}" >&2
  55.         exit 1
  56.         ;;
  57. esac
  58.  
  59. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement