Fix minor typo
[matches/MCTX3420.git] / testing / fastcgi-approach / mctxserv
1 #!/bin/bash
2
3 USER=www-data
4 GROUP=www-data
5 HOST=127.0.0.1
6 PORT=9005
7
8 CGI_NAME=/usr/bin/mctxserv
9 CGI_BASENAME=`basename $CGI_NAME`
10 PID=/var/run/$CGI_BASENAME.pid
11 DAEMON=/usr/bin/spawn-fcgi
12 DAEMON_BASENAME=`basename $DAEMON`
13 DAEMON_OPTS="-a $HOST -p $PORT -u $USER -g $GROUP -P $PID $CGI_NAME"
14
15 #Test if daemon exists
16 [ -x "$DAEMON" ] || (echo $DAEMON doesn\'t exist! && exit 1)
17 #Test if cgi module exists
18 [ -x "$CGI_NAME" ] || (echo $CGI_BASENAME doesn\'t exist! && exit 1)
19
20 start() {
21         echo -n "Starting FastCGI Daemon: "
22         start-stop-daemon --start --quiet --pidfile $PID \
23                         --exec $DAEMON -- $DAEMON_OPTS > /dev/null
24         RETVAL=$?
25         echo "$CGI_BASENAME."
26 }
27 stop() {
28         echo -n "Stopping FastCGI Daemon: "
29         start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PID
30         RETVAL=$?
31         echo "$CGI_BASENAME."
32 }
33
34 case "$1" in
35         start)
36                 start
37         ;;
38         stop)
39                 stop
40         ;;
41         restart)
42                 stop
43                 start
44         ;;
45         *)
46                 echo "Usage: mctxserv {start|stop|restart}"
47                 exit 1
48         ;;
49 esac
50 exit $RETVAL

UCC git Repository :: git.ucc.asn.au