Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 477708 - web-apps/tt-rss init.d script doesn't shut down cleanly
Summary: web-apps/tt-rss init.d script doesn't shut down cleanly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Patrick
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-07-22 07:15 UTC by John J. Aylward
Modified: 2013-09-12 06:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/init.d/ttrssd init script with pid support (ttrssd,2.16 KB, text/plain)
2013-07-22 07:15 UTC, John J. Aylward
Details
add pid support to init script, prevent deep directory hierarchy under /run/ttrssd (ttrssd.initd.patch,3.26 KB, patch)
2013-07-25 14:25 UTC, Patrick
Details | Diff
add pid support to init script, prevent deep directory hierarchy under /run/ttrssd (ttrssd.initd.patch,2.65 KB, patch)
2013-09-12 04:42 UTC, Patrick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John J. Aylward 2013-07-22 07:15:54 UTC
Created attachment 353840 [details]
/etc/init.d/ttrssd init script with pid support

currently the init.d script relies on the process name to kill the ttrssd daemon but because it's a php process which spawns sub php processes, the start-stop-daemon won't stop the process properly when the worker thread are going, or if multiple instances are running. This has caused some issues with the log rotation's restart of the daemon where the daemon will not restart properly after the log rotate.

The attached init.d script modifies the start-stop-daemon call to generate pid files for each instance running. I haven't found any issues with this process.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2013-07-23 12:53:52 UTC
Comment on attachment 353840 [details]
/etc/init.d/ttrssd init script with pid support

--- files/ttrssd.initd-r1       2013-07-06 18:55:18.370752745 +0200
+++ -   2013-07-23 14:53:41.541634145 +0200
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/www-apps/tt-rss/files/ttrssd.initd-r1,v 1.3 2013/07/03 20:30:34 hwoarang Exp $
+# $Header: /var/cvsroot/gentoo-x86/www-apps/tt-rss/files/ttrssd.initd-r1,v 1.2 2013/04/06 07:40:52 scarabeus Exp $
 
 depend() {
        need logger net
@@ -12,6 +12,7 @@
 TTRSSD_USER=${TTRSSD_USER:-"ttrssd"}
 TTRSSD_GROUP=${TTRSSD_GROUP:-"ttrssd"}
 INSTANCE_FOLDERS="cache lock feed-icons"
+BASE_PID="/run/ttrssd"
 
 checkconfig() {
        local instance dir
@@ -35,6 +36,8 @@       
                        eerror "Please check your installation or the INSTANCE_DIRS variable."
                        return 1
                fi
+
+               mkdir -p "${BASE_PID}/${instance}"
                
                # FIXME: This should be done by webapp-config during install
                for dir in ${INSTANCE_FOLDERS}; do
@@ -52,9 +55,11 @@
        checkconfig || return 1

        for instance in ${INSTANCE_DIRS}; do
+               MYPID="${BASE_PID}/${instance}/pid"
                ebegin "Starting TT-RSS update daemon in \"${instance}\""
                start-stop-daemon --start --user "${TTRSSD_USER}":"${TTRSSD_GROUP}" --background \
                        --stdout "${LOGFILE}" --stderr "${LOGFILE}" \
+                       --make-pidfile --pidfile "${MYPID}" \
                        --exec /usr/bin/php -- -f "${instance}/update_daemon2.php"
                eend $?
        done
@@ -64,9 +69,11 @@
        local instance

        for instance in ${INSTANCE_DIRS}; do
+               MYPID="${BASE_PID}/${instance}/pid"
                ebegin "Stopping TT-RSS update daemon in \"${instance}\""
-               start-stop-daemon --stop  --retry 30 \
-                       --exec /usr/bin/php -- -f "${instance}/update_daemon2.php"
+               start-stop-daemon --stop \
+               --pidfile "${MYPID}" \
+               --exec /usr/bin/php -- -f "${instance}/update_daemon2.php"
                eend $?
                rm -f ${instance}/lock/*.lock
        done
Comment 2 Patrick 2013-07-25 14:25:03 UTC
Created attachment 354182 [details, diff]
add pid support to init script, prevent deep directory hierarchy under /run/ttrssd

Markos, what do you think, can we put this under files, together with the 1.9 bump (which would then have line 70 changed from -r1 to -r2)?
Comment 3 Markos Chandras (RETIRED) gentoo-dev 2013-07-25 14:35:54 UTC
Yeah I suppose we could. I will have a look
Comment 4 Markos Chandras (RETIRED) gentoo-dev 2013-09-11 18:28:42 UTC
The current patch does not apply to the current ttrssd.initd-r1. Can we have an updated patch please?
Comment 5 Patrick 2013-09-12 04:42:50 UTC
Created attachment 358508 [details, diff]
add pid support to init script, prevent deep directory hierarchy under /run/ttrssd

Sorry, no idea what happened there. This should apply to -r1.
Comment 6 Thomas Kahle (RETIRED) gentoo-dev 2013-09-12 06:44:59 UTC
applied 1.9, please test.