#!/bin/sh # System startup script for Quixote web app. SERVER_TYPE=scgi # "simple" or "scgi" USER=web PIDFILE=/var/run/quixote.pid # Check for missing binaries (stale symlinks should not happen) # Note: Special treatment of stop for LSB conformance DAEMON=$USER/bin/qrun.py ARGS="--server-type=$SERVER_TYPE --user=$USER \ --pidfile $PIDFILE --background" test -x $DAEMON || { echo "$DAEMON not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } # Source LSB init functions .. /lib/lsb/init-functions if test -f /etc/redhat-release; then # Even though it claims to conform to LSB 3.0, Red Hat (as of # Enterprise Linux ES release 4) does not accept the -p argument # to start_daemon, pidofproc, and killproc running () { ##pidofproc -p $PIDFILE $DAEMON >/dev/null test -f $PIDFILE && ps -p `cat $PIDFILE` > /dev/null } do_start () { $DAEMON $ARGS } do_kill () { if running; then kill -TERM `cat $PIDFILE` status=$? rm -f $PIDFILE return $status fi } else running () { pidofproc -p $PIDFILE $DAEMON >/dev/null } do_start () { start_daemon -p $PIDFILE $DAEMON $ARGS } do_kill () { killproc -p $PIDFILE $DAEMON } fi case "$1" in start) echo -n "Starting Quixote server... " if ! running then if do_start; then log_success_msg "okay." else log_failure_msg "failed." fi else log_success_msg "okay." fi ;; stop) echo -n "Shutting down Quixote server... " if do_kill; then log_success_msg "stopped." fi ;; try-restart) ## Do a restart only if the service was active before. if running then $0 restart fi ;; restart) $0 stop $0 start ;; force-reload) echo -n "Reload Quixote server " $0 try-restart ;; reload) ## Like force-reload, but if daemon does not support ## signaling, do nothing (!) exit 3 ;; status) echo -n "Checking for Quixote server... " if running then echo "running." exit 0 else echo "stopped." exit 3 fi ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" exit 1 ;; esac