Page MenuHomePhabricator

freebsdrc.sh

Authored By
epriestley
Nov 28 2013, 5:11 AM
Size
1 KB
Referenced Files
None
Subscribers
None

freebsdrc.sh

#!/bin/sh
# $FreeBSD$
#
# PROVIDE: phd
# REQUIRE: LOGIN mysql
# KEYWORD: phd
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# phd_enable (bool): Set to NO by default.
# Set it to YES to enable the Phabricator Daemon.
#
. /etc/rc.subr
name="phd"
rcvar=${name}_enable
start_cmd="${name}_start"
stop_cmd="${name}_stop"
restart_cmd="${name}_restart"
status_cmd="${name}_status"
phd_user="www"
command_prefix="su -m ${phd_user} -c"
command="/www/phabricator/bin/phd"
phd_start() {
echo 'Starting the Phabricator Daemon ...'
mysqltime=`ps aux | grep mysqld | egrep -v "grep|safe" | awk '{print $9}'`
echo $mysqltime | grep -q ':'
if [ $? -eq 0 ]; then
mysqltime=`date -j -f "%I:%M%p" "${mysqltime}" +"%s"`
currtime=`date +"%s"`
diffsec=$(( $currtime - $mysqltime ));
if [ $diffsec -le 120 ]; then
sleep 15 # Give MySQL some time to warm up before invoking
fi
fi
$command_prefix " $command start "
}
phd_stop() {
echo 'Attempting to stop the Phabricator Daemon ...'
$command_prefix " $command stop "
}
phd_restart() {
echo 'Retarting the Phabricator Daemon ...'
$command_prefix " $command restart "
}
phd_status() {
$command_prefix " $command status "
}
load_rc_config $name
: ${phd_enable="NO"}
run_rc_command "$1"

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/r5/bj/ssyovuo5v2nvajuq
Default Alt Text
freebsdrc.sh (1 KB)

Event Timeline