Link Here
|
22 |
long_name="Tiny Tiny RSS updating feeds daemon." |
22 |
long_name="Tiny Tiny RSS updating feeds daemon." |
23 |
required_files="%%WWWDIR%%/config.php" |
23 |
required_files="%%WWWDIR%%/config.php" |
24 |
pidfile="/var/run/${name}.pid" |
24 |
pidfile="/var/run/${name}.pid" |
|
|
25 |
cpidfile="/var/run/${name}_child.pid" |
26 |
phpcli="%%LOCALBASE%%/bin/php" |
25 |
|
27 |
|
26 |
initdb_php="%%WWWDIR%%/update.php" |
28 |
initdb_php="%%WWWDIR%%/update.php" |
27 |
phpupd="%%WWWDIR%%/update_daemon2.php" |
29 |
phpupd="%%WWWDIR%%/update_daemon2.php" |
28 |
ttrssd_log="/var/log/${name}.log" |
30 |
ttrssd_log="/var/log/${name}.log" |
29 |
|
31 |
|
30 |
command="/usr/sbin/daemon" |
32 |
command="/usr/sbin/daemon" |
31 |
command_args="-rR 10 -H -P $pidfile -u %%WWWOWN%% \ |
33 |
command_args="-rR 10 -H -u %%WWWOWN%% \ |
|
|
34 |
-P $pidfile -p $cpidfile \ |
32 |
-o $ttrssd_log sh -c \ |
35 |
-o $ttrssd_log sh -c \ |
33 |
'$initdb_php --update-schema=force-yes; $phpupd'" |
36 |
'$initdb_php --update-schema=force-yes; \ |
|
|
37 |
$phpupd;'" |
38 |
|
39 |
stop_cmd="${name}_stop" |
40 |
|
41 |
# daemon doesn't process signals if it lacks a child process. |
42 |
# See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277959 |
43 |
ttrssd_stop() { |
44 |
local pid_daemon |
45 |
local pid_child |
46 |
local signal="TERM" |
47 |
|
48 |
pid_daemon=$(check_pidfile ${pidfile} ${command}) |
49 |
pid_child=$(check_pidfile ${cpidfile} ${phpcli}) |
50 |
|
51 |
if [ -n "$pid_daemon" ]; then |
52 |
echo "Stopping ${name}." |
53 |
|
54 |
if [ -z "${pid_child}" ]; then |
55 |
signal="INT" |
56 |
fi |
57 |
|
58 |
kill -"$signal" "${pid_daemon}" |
59 |
|
60 |
wait_for_pids "${pid_daemon}" "${pid_child}" |
61 |
else |
62 |
if [ -n "$pid_child" ]; then |
63 |
echo "${name} not running? (check ${cpidfile})." |
64 |
else |
65 |
echo "${name} not running? (check ${pidfile})." |
66 |
fi |
67 |
fi |
68 |
} |
34 |
|
69 |
|
35 |
run_rc_command "$1" |
70 |
run_rc_command "$1" |
36 |
- |
|
|