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 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
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)?
Yeah I suppose we could. I will have a look
The current patch does not apply to the current ttrssd.initd-r1. Can we have an updated patch please?
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.
applied 1.9, please test.