#! /bin/sh ### BEGIN INIT INFO # Provides: p4d # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: S 0 1 6 # Short-Description: Perforce SCM # Description: Perforce Source Code Management service # ### END INIT INFO # # Perforce Source Code Management # # Author: Tony Sweeney <sweeney@addr.com> # # Install as /etc/init.d/p4d # # Create run level links with "[sudo ]update-rc.d p4d defaults" # Remove run level links with "[sudo ]update-rc.d p4d remove" # set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="Perforce SCM" # See how we've been called if [ -h $0 ]; then INITSCRIPT=`readlink $0` # Chase runlevel link else INITSCRIPT=$0 # Invoked directly fi NAME=`basename $INITSCRIPT` DAEMON=/usr/sbin/$NAME DAEMON_USER=perforce PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME test -x $DAEMON || exit 0 # Perforce environment variables. if [ -f /etc/default/$NAME ]; then . /etc/default/$NAME fi # log_daemon_message lives here . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" start-stop-daemon --start --quiet --pidfile $PIDFILE \ --background --make-pidfile \ --exec $DAEMON --chuid $DAEMON_USER -- log_end_msg $? ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" start-stop-daemon --stop --quiet --pidfile $PIDFILE \ --oknodo --retry 60 --exec $DAEMON log_end_msg $? ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" start-stop-daemon --stop --quiet --pidfile $PIDFILE \ --oknodo --retry 60 --exec $DAEMON start-stop-daemon --start --quiet --pidfile $PIDFILE \ --background --make-pidfile \ --exec $DAEMON --chuid $DAEMON_USER -- log_end_msg $? ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 6069 | Tony Sweeney |
Not one but three Debian init scripts. Pick one that you like (README(s) to follow). Tested on Ubuntu 7.10. Use as you will. |