InitScript

From Request Tracker Wiki
Jump to navigation Jump to search
   #!/bin/sh
   
   RTPATH=/path/to/rt RTUSER=rt FCGI_SOCKET_PATH=$RTPATH/var/appSocket
   
   case $1 in
     start)
         echo -n "Starting RT: mason_handler.fcgi"
         cd $RTPATH
         export FCGI_SOCKET_PATH
         su $RTUSER -c perl bin/mason_handler.fcgi &
         echo
         ;;
     
     stop)
         echo -n "Stopping RT: "
         PIDS=`ps axww | awk '/[m]ason_handler.fcgi/ { print $1}'`
         if [ -n "$PIDS" ]
         then
             echo -n kill -TERM $PIDS
             kill $PIDS
             echo
         else
             echo RT not running
         fi
         ;;
     
     restart|force-reload)
         $0 stop
         $0 start
         ;;
     
     *)
         echo "Usage: /etc/init.d/rt { stop | start | restart }"
         exit 1
         ;;
   esac