Advertisement
Guest User

Untitled

a guest
Nov 8th, 2013
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.71 KB | None | 0 0
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          tracd
  4. # Required-Start:    networking
  5. # Required-Stop:     networking
  6. # Default-Start:     2 3 4 5
  7. # Default-Stop:      0 1 6
  8. # Short-Description: Start the tracd standalone Trac web server.
  9. ### END INIT INFO
  10. # (C) 2008 Guy Rutenberg <http://www.guyrutenberg.com>
  11.  
  12. ## Options you should probably change ##
  13. # HOSTNAME=127.0.0.1 # to which hostname should we listen
  14. # If you only want to serve one project keep this variable
  15. # empty and set the PROJECT_ENV variable
  16. #ENV_PARENT_DIR=/home/guyru/trac.guyrutenberg.com
  17. PROJECT_ENV=/var/Trac
  18. PORT=8000
  19. #ADDITIONAL_OPTS="-s --basic-auth=\"ER,$PROJECT_ENV/.htpasswd,\" "
  20.  
  21. ## Options you should probably not change ##
  22. DAEMON=/usr/bin/tracd
  23. NAME=tracd
  24. DESC="trac web server"
  25. PIDFILE=/var/run/$NAME.pid
  26. SCRIPTNAME=/etc/init.d/$NAME
  27. SSD="/sbin/start-stop-daemon"
  28.  
  29. test -x $DAEMON || exit 1
  30.  
  31. set -e
  32.  
  33. . /lib/lsb/init-functions
  34.  
  35. DAEMON_OPTS="--daemonize -s --pidfile=$PIDFILE --port=$PORT --basic-auth=\"Trac,/var/Trac/.htpasswd,\" $PROJECT_ENV"
  36.  
  37. case "$1" in
  38.   start)
  39.     log_daemon_msg "Starting $DESC" $NAME
  40.     if ! $SSD --start --quiet\
  41.     --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
  42.             log_end_msg 1
  43.     else
  44.             log_end_msg 0
  45.     fi
  46.     ;;
  47.   stop)
  48.     log_daemon_msg "Stopping $DESC" $NAME
  49.     if $SSD --stop --retry 30\
  50.     --pidfile $PIDFILE ; then
  51.         rm -f $PIDFILE
  52.         log_end_msg 0
  53.     else
  54.         log_end_msg 1
  55.     fi
  56.     ;;
  57.   restart|force-reload)
  58.     $0 stop
  59.     [ -r  $PIDFILE ] && while pidof -x $NAME |\
  60.          grep -q `cat $PIDFILE 2>/dev/null` 2>/dev/null ; do sleep 1; done
  61.     $0 start
  62.     ;;
  63.   *)
  64.     echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
  65.     exit 1
  66.     ;;
  67. esac
  68.  
  69. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement