Permalink
Browse files

Added correct stop for daemon with delay.

  • Loading branch information...
1 parent f169593 commit 406658a2cfa6cf635ea3a6e1d9661c42647878d8 @ekilimchuk ekilimchuk committed Aug 29, 2012
Showing with 28 additions and 9 deletions.
  1. +6 −0 debian/changelog
  2. +22 −9 extra/fastcgi-daemon2
View
@@ -1,3 +1,9 @@
+fastcgi-daemon2 (2.10-11) unstable; urgency=low
+
+ * Added correct stop for daemon with delay.
+
+ -- Eugene Kilimchuk <ekilimchuk@yandex-team.ru> Wed, 29 Aug 2012 15:46:27 +0400
+
fastcgi-daemon2 (2.10-10) unstable; urgency=low
* getContentLength method fixed in case of exceptions
View
@@ -98,15 +98,28 @@ stop() {
continue
fi
echo "Name: $FASTCGI"
- #Kill fastcgistart
- start-stop-daemon --quiet --stop --signal 0 --pidfile $PID_DIR/fastcgistart2.$FASTCGI.pid 2>&1 >/dev/null
- start-stop-daemon --quiet --signal 15 --stop --pidfile $PID_DIR/fastcgistart2.$FASTCGI.pid 2>&1 >/dev/null
- start-stop-daemon --quiet --signal 9 --stop --pidfile $PID_DIR/fastcgistart2.$FASTCGI.pid 2>&1 >/dev/null
- #Kill daemon
- start-stop-daemon --quiet --stop --signal 0 --pidfile $PID_DIR/$FASTCGI.pid 2>&1 >/dev/null
- start-stop-daemon --quiet --signal 15 --stop --pidfile $PID_DIR/$FASTCGI.pid 2>&1 >/dev/null
- sleep $DELAY
- start-stop-daemon --quiet --signal 9 --stop --pidfile $PID_DIR/$FASTCGI.pid 2>&1 >/dev/null
+
+ if start-stop-daemon --quiet --stop --signal 0 --pidfile $PID_DIR/fastcgistart2.$FASTCGI.pid 2>&1 >/dev/null || start-stop-daemon --quiet --stop --signal 0 --pidfile $PID_DIR/$FASTCGI.pid 2>&1 >/dev/null; then
+ start-stop-daemon --quiet --signal 15 --stop --pidfile $PID_DIR/fastcgistart2.$FASTCGI.pid 2>&1 >/dev/null
+ start-stop-daemon --quiet --signal 15 --stop --pidfile $PID_DIR/$FASTCGI.pid 2>&1 >/dev/null
+ for i in `seq 1 30`; do
+ if start-stop-daemon --quiet --stop --signal 0 --pidfile $PID_DIR/fastcgistart2.$FASTCGI.pid 2>&1 >/dev/null || start-stop-daemon --quiet --stop --signal 0 --pidfile $PID_DIR/$FASTCGI.pid 2>&1 >/dev/null; then
+ kill9=1
+ echo -n "."
+ sleep 1
+ else
+ kill9=0
+ break
+ fi
+ done
+ if [ $kill9 -ne 0 ]; then
+ start-stop-daemon --quiet --signal 9 --stop --pidfile $PID_DIR/fastcgistart2.$FASTCGI.pid 2>&1 >/dev/null
+ start-stop-daemon --quiet --signal 9 --stop --pidfile $PID_DIR/$FASTCGI.pid 2>&1 >/dev/null
+ echo "Sended kill -9"
+ fi
+ else
+ echo "Stoped."
+ fi
echo "Stopping $FASTCGI done"
if [ "x$1" = "x" ]; then
if [ -x $POSTSTOP_DIR/$FASTCGI.sh ]; then

0 comments on commit 406658a

Please sign in to comment.