-
-
Save FunTimeCoding/da210e2a3b7389a72682 to your computer and use it in GitHub Desktop.
phabricator daemons init script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### 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 | |
# Short-Description: phabricator | |
# Description: manages phd | |
### END INIT INFO | |
# Author: Alexander Reitzel <[email protected]> | |
# Do NOT "set -e" | |
PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
DESC="phabricator daemons" | |
NAME=phd | |
USER=shiin | |
DAEMON=/var/www/phabricator/phabricator/bin/${NAME} | |
SCRIPTNAME=/etc/init.d/${NAME} | |
[ -x "${DAEMON}" ] || exit 0 | |
[ -r /etc/default/${NAME} ] && . /etc/default/${NAME} | |
. /lib/init/vars.sh | |
. /lib/lsb/init-functions | |
run_as_user() | |
{ | |
sudo -u "${USER}" -s /bin/bash -c "${1}" | |
} | |
is_running() | |
{ | |
if run_as_user "${DAEMON} status"; then | |
return 0 | |
else | |
return 1 | |
fi | |
} | |
do_start() | |
{ | |
if is_running; then | |
return 1 | |
fi | |
run_as_user "${DAEMON} start" | |
return 0 | |
} | |
do_stop() | |
{ | |
if ! is_running; then | |
return 1 | |
fi | |
run_as_user "${DAEMON} stop" | |
return 0 | |
} | |
case "${1}" in | |
start) | |
[ "${VERBOSE}" != no ] && log_daemon_msg "Starting ${DESC}" "${NAME}" | |
do_start | |
;; | |
stop) | |
[ "${VERBOSE}" != no ] && log_daemon_msg "Stopping ${DESC}" "${NAME}" | |
do_stop | |
;; | |
status) | |
if is_running; then | |
exit 0 | |
else | |
exit 1 | |
fi | |
;; | |
restart) | |
log_daemon_msg "Restarting ${DESC}" "${NAME}" | |
do_stop | |
do_start | |
;; | |
*) | |
echo "Usage: ${SCRIPTNAME} {start|stop|status|restart}" >&2 | |
exit 3 | |
;; | |
esac |
Even with the --local
modification it seems to only want to spin up one of the daemons on boot. The taskmaster one to be precise. It will only start them all if you restart it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
…or maybe not. Now even
phd status --local
lists those dead daemons, only marking them with<DEAD>
. Not sure what is the proper way to detect running daemons.