Lines 4-10
Link Here
|
4 |
# |
4 |
# |
5 |
|
5 |
|
6 |
# PROVIDE: phd |
6 |
# PROVIDE: phd |
7 |
# REQUIRE: LOGIN |
7 |
# REQUIRE: LOGIN mysql |
8 |
# KEYWORD: shutdown |
8 |
# KEYWORD: shutdown |
9 |
|
9 |
|
10 |
# |
10 |
# |
Lines 23-33
Link Here
|
23 |
|
23 |
|
24 |
: ${phd_enable="NO"} |
24 |
: ${phd_enable="NO"} |
25 |
: ${phd_user="www"} |
25 |
: ${phd_user="www"} |
|
|
26 |
: ${phd_pids_dir=""} |
26 |
|
27 |
|
27 |
command="%%PREFIX%%/lib/php/phabricator/bin/phd" |
28 |
command="%%PREFIX%%/lib/php/phabricator/bin/phd" |
|
|
29 |
phd_config="%%PREFIX%%/lib/php/phabricator/conf/local/local.json" |
28 |
|
30 |
|
29 |
extra_commands="launch list log" |
31 |
extra_commands="launch list log" |
30 |
poll_cmd="phd_poll" |
32 |
poll_cmd="phd_poll" |
|
|
33 |
start_precmd="${name}_prestart" |
34 |
start_cmd="${command} start" |
31 |
stop_cmd="${command} stop" |
35 |
stop_cmd="${command} stop" |
32 |
status_cmd="${command} status" |
36 |
status_cmd="${command} status" |
33 |
restart_cmd="phd_restart" |
37 |
restart_cmd="phd_restart" |
Lines 35-50
Link Here
|
35 |
list_cmd="${command} list" |
39 |
list_cmd="${command} list" |
36 |
log_cmd="${command} log" |
40 |
log_cmd="${command} log" |
37 |
|
41 |
|
38 |
start_precmd="eval command_args=start" |
42 |
required_files="${phd_config}" |
39 |
|
43 |
|
40 |
required_files="%%PREFIX%%/lib/php/phabricator/conf/local/local.json" |
|
|
41 |
|
42 |
PATH="${PATH}:%%PREFIX%%/bin" |
44 |
PATH="${PATH}:%%PREFIX%%/bin" |
43 |
|
45 |
|
|
|
46 |
if [ ! -n "${phd_pids_dir}" ]; then |
47 |
# Try to read from config. |
48 |
phd_pids_dir=$(grep -Eo '"phd.pid-directory":(\d*?,|.*?[^\\]",)' \ |
49 |
"${phd_config}" | \ |
50 |
sed -e "s/\"phd.pid-directory\" *: *\"//" -e 's/",.*//') |
51 |
fi |
52 |
if [ ! -n "${phd_pids_dir}" ]; then |
53 |
# Default location. |
54 |
phd_pids_dir="/var/tmp/phd/pid" |
55 |
fi |
56 |
|
57 |
|
58 |
phd_prestart() |
59 |
{ |
60 |
install -d -o "${phd_user}" -g wheel -m 0777 "${phd_pids_dir}" |
61 |
find "${phd_pids_dir}" -name "daemon.*" -type f -delete |
62 |
} |
63 |
|
44 |
phd_poll() |
64 |
phd_poll() |
45 |
{ |
65 |
{ |
46 |
pids=`${status_cmd} 2>/dev/null | awk '{ print $4 }' | egrep "^[0-9]+$" | sort | uniq` |
66 |
pids=`${status_cmd} 2>/dev/null | awk '{ print $4 }' | egrep "^[0-9]+$" | sort | uniq` |
47 |
wait_for_pids $pids |
67 |
if [ -n "${pids}" ]; then |
|
|
68 |
kill "${pids}" |
69 |
wait_for_pids "${pids}" |
70 |
fi |
71 |
find "${phd_pids_dir}" -name "daemon.*" -type f -delete |
48 |
} |
72 |
} |
49 |
|
73 |
|
50 |
phd_restart() |
74 |
phd_restart() |