LEFT | RIGHT |
(no file at all) | |
| 1 #!/bin/bash |
| 2 ### BEGIN INIT INFO |
| 3 # Provides: hgwebdir |
| 4 # Required-Start: $local_fs $remote_fs $network |
| 5 # Required-Stop: $local_fs $remote_fs $network |
| 6 # Default-Start: 3 5 |
| 7 # Default-Stop: 0 1 2 6 |
| 8 # Description: HG FastCGI server |
| 9 ### END INIT INFO |
| 10 |
| 11 SCRIPT=/opt/hgweb.fcgi |
| 12 FCGI_SOCKET=/var/run/hgweb.sock |
| 13 PID_FILE=/var/run/hgweb.pid |
| 14 USER=www-data |
| 15 |
| 16 start() { |
| 17 spawn-fcgi -f $SCRIPT -s $FCGI_SOCKET -P $PID_FILE -u $USER |
| 18 } |
| 19 |
| 20 stop() { |
| 21 if [ -e "$PID_FILE" ]; then |
| 22 kill -9 `cat $PID_FILE` && rm $PID_FILE && rm $FCGI_SOCKET |
| 23 else |
| 24 echo "daemon not running" >&2 |
| 25 fi |
| 26 } |
| 27 |
| 28 help() { |
| 29 echo "Usage: $0 {start|stop|restart}" |
| 30 test 'help' = "$1" |
| 31 } |
| 32 |
| 33 case "$1" in |
| 34 start|stop) $1;; |
| 35 restart) stop; start;; |
| 36 *) help "$@";; |
| 37 esac |
LEFT | RIGHT |