Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ### BEGIN INIT INFO
- # Provides: tracd
- # Required-Start: networking
- # Required-Stop: networking
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: Start the tracd standalone Trac web server.
- ### END INIT INFO
- # (C) 2008 Guy Rutenberg <http://www.guyrutenberg.com>
- ## Options you should probably change ##
- # HOSTNAME=127.0.0.1 # to which hostname should we listen
- # If you only want to serve one project keep this variable
- # empty and set the PROJECT_ENV variable
- #ENV_PARENT_DIR=/home/guyru/trac.guyrutenberg.com
- PROJECT_ENV=/var/Trac
- PORT=8000
- #ADDITIONAL_OPTS="-s --basic-auth=\"ER,$PROJECT_ENV/.htpasswd,\" "
- ## Options you should probably not change ##
- DAEMON=/usr/bin/tracd
- NAME=tracd
- DESC="trac web server"
- PIDFILE=/var/run/$NAME.pid
- SCRIPTNAME=/etc/init.d/$NAME
- SSD="/sbin/start-stop-daemon"
- test -x $DAEMON || exit 1
- set -e
- . /lib/lsb/init-functions
- DAEMON_OPTS="--daemonize -s --pidfile=$PIDFILE --port=$PORT --basic-auth=\"Trac,/var/Trac/.htpasswd,\" $PROJECT_ENV"
- case "$1" in
- start)
- log_daemon_msg "Starting $DESC" $NAME
- if ! $SSD --start --quiet\
- --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
- log_end_msg 1
- else
- log_end_msg 0
- fi
- ;;
- stop)
- log_daemon_msg "Stopping $DESC" $NAME
- if $SSD --stop --retry 30\
- --pidfile $PIDFILE ; then
- rm -f $PIDFILE
- log_end_msg 0
- else
- log_end_msg 1
- fi
- ;;
- restart|force-reload)
- $0 stop
- [ -r $PIDFILE ] && while pidof -x $NAME |\
- grep -q `cat $PIDFILE 2>/dev/null` 2>/dev/null ; do sleep 1; done
- $0 start
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
- exit 1
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement