Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P1012
freebsdrc.sh
Active
Public
Actions
Authored by
epriestley
on Nov 28 2013, 5:11 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Flag For Later
Award Token
Tags
None
Referenced Files
F85687: freebsdrc.sh
Nov 28 2013, 5:11 AM
2013-11-28 05:11:31 (UTC+0)
Subscribers
None
#!/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
"
Event Timeline
epriestley
edited the content of this paste.
(Show Details)
Nov 28 2013, 5:11 AM
2013-11-28 05:11:31 (UTC+0)
epriestley
changed the title of this paste from untitled to
freebsdrc.sh
.
epriestley
updated the paste's language from
autodetect
to
autodetect
.
Comment Actions
Placed in /usr/local/etc/rc.d, then in /etc/rc.d add: phd_enable="YES"
Log In to Comment