75
|
1 |
#!/sbin/runscript |
|
2 |
|
|
3 |
LOGFILE=/var/log/ttrssd.log |
|
4 |
|
|
5 |
depend() { |
|
6 |
need logger net |
|
7 |
} |
|
8 |
|
|
9 |
start () { |
|
10 |
ebegin "Starting TT-RSS update daemon(s)" |
|
11 |
[ -z "${INSTANCE_DIRS}" ] && { echo "No instance directories specified in /etc/conf.d/ttrssd."; exit 1; } |
|
12 |
|
|
13 |
# Make sure the log file can be written to |
|
14 |
touch ${LOGFILE} && chown ttrssd ${LOGFILE} |
|
15 |
|
|
16 |
for INSTANCE_DIR in ${INSTANCE_DIRS}; do |
|
17 |
[ -f "${INSTANCE_DIR}/update_daemon2.php" ] || continue |
|
18 |
einfo " ${INSTANCE_DIR}" |
|
19 |
|
|
20 |
# Since I have no idea how I could do this during the webapp-config installation, |
|
21 |
# lets do it during start up... |
|
22 |
for DIR in cache cache/htmlpurifier cache/magpie cache/simplepie cache/images cache/export lock feed-icons; do |
|
23 |
[ -d "${INSTANCE_DIR}/${DIR}" ] && chgrp ttrssd "${INSTANCE_DIR}/${DIR}" |
|
24 |
[ -d "${INSTANCE_DIR}/${DIR}" ] && chmod g+w "${INSTANCE_DIR}/${DIR}" |
|
25 |
done |
|
26 |
|
|
27 |
# Finally run the PHP script |
|
28 |
start-stop-daemon --start -u ttrssd:ttrssd -b \ |
|
29 |
-1 /var/log/ttrssd.log -2 /var/log/ttrssd.log \ |
|
30 |
-x /usr/bin/php "${INSTANCE_DIR}/update_daemon2.php" |
|
31 |
done |
|
32 |
eend $? |
|
33 |
} |
|
34 |
|
|
35 |
stop() { |
|
36 |
ebegin "Stopping TT-RSS update daemon(s)" |
|
37 |
for INSTANCE_DIR in ${INSTANCE_DIRS}; do |
|
38 |
[ -f "${INSTANCE_DIR}/update_daemon2.php" ] || continue |
|
39 |
einfo " ${INSTANCE_DIR}" |
|
40 |
start-stop-daemon --stop -x /usr/bin/php \ |
|
41 |
"${INSTANCE_DIR}/update_daemon2.php" && \ |
|
42 |
rm -f ${INSTANCE_DIR}/lock/*.lock |
|
43 |
done |
|
44 |
eend $? |
|
45 |
} |