aboutsummaryrefslogtreecommitdiff
path: root/devel/phabricator/files/phd.in
blob: 3424694e52b34ba88a91ba7033a421373ed18600 (plain) (blame)
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
#!/bin/sh

# PROVIDE: phd
# REQUIRE: LOGIN
# KEYWORD: shutdown

#
# Add the following line to /etc/rc.conf to enable phabricator daemons:
# phd_enable (bool):	Set to "NO" by default
#			Set it to "YES" to enable phd
# phd_fib (str):	Set an altered default network view for phd
# phd_user (str):	User to run phabricator daemons as

. /etc/rc.subr

name="phd"
rcvar=phd_enable

load_rc_config "$name"

: ${phd_enable="NO"}
: ${phd_user="www"}

command="%%PREFIX%%/lib/php/phabricator/bin/phd"

extra_commands="launch list log"
poll_cmd="phd_poll"
stop_cmd="${command} stop"
status_cmd="${command} status"
restart_cmd="phd_restart"
launch_cmd="${command} launch"
list_cmd="${command} list"
log_cmd="${command} log"

start_precmd="eval command_args=start"

required_files="%%PREFIX%%/lib/php/phabricator/conf/local/local.json"

PATH="${PATH}:%%PREFIX%%/bin"

phd_poll()
{
	pids=`${status_cmd} 2>/dev/null | awk '{ print $4 }' | egrep "^[0-9]+$" | sort | uniq`
	wait_for_pids $pids
}

phd_restart()
{
	${stop_cmd}
	phd_poll
	run_rc_command start
}

run_rc_command "$*"