1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#! /bin/sh -e
### BEGIN INIT INFO
# Provides: phd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: mysql
# Should-Stop: mysql
# Short-Description: phd
# Description: phabricator daemons
### END INIT INFO
DAEMON="/usr/share/phabricator/bin/phd"
#DAEMON_OPT=""
DAEMONUSER="phabricator"
DAEMON_NAME="phd"
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
d_start () {
check_pid_dir
log_daemon_msg "Starting system $DAEMON_NAME Daemon"
start-stop-daemon --start --quiet --chuid $DAEMONUSER --exec $DAEMON -- start
log_end_msg $?
}
d_stop () {
log_daemon_msg "Stopping system $DAEMON_NAME Daemon"
start-stop-daemon --start --quiet --chuid $DAEMONUSER --exec $DAEMON -- stop
log_end_msg $?
}
check_pid_dir() {
# Create the pid directory if necessary
if [ ! -d /run/phabricator ]; then
mkdir /run/phabricator
chown $DAEMONUSER:nogroup /run/phabricator
fi
}
case "$1" in
start|stop)
d_${1}
;;
restart|reload|force-reload)
d_stop
d_start
;;
status)
$DAEMON status && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|reload|force-reload|status}"
exit 1
;;
esac
exit 0
|