freeswitch-stable: add SIGKILL to init script 359/head
authorSebastian Kemper <sebastian_ml@gmx.net>
Sun, 5 Aug 2018 13:04:13 +0000 (15:04 +0200)
committerSebastian Kemper <sebastian_ml@gmx.net>
Sun, 5 Aug 2018 13:04:16 +0000 (15:04 +0200)
Sometimes freeswitch doesn't exit after receiving the SIGTERM signal.
This can be reproduced by sending SIGTERM to a freeswitch instance which
is initializing (which can take quite some time).

Instead of just giving up and exiting - leaving a hung freeswitch
process on the system - this commit adds some lines to the init script
that send SIGKILL to freeswitch in case the attempt to terminate it with
SIGTERM fails.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
net/freeswitch-stable/Makefile
net/freeswitch-stable/files/freeswitch.init

index c416b60d0dd7092c6320ecc2d96b7de9a559d663..991f123959b94f142622513f5a298fd490bc7479 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PRG_NAME:=freeswitch
 PKG_NAME:=$(PRG_NAME)-stable
 PKG_VERSION:=1.6.20
-PKG_RELEASE:=8
+PKG_RELEASE:=9
 PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
 
 PKG_SOURCE:=$(PRG_NAME)-$(PKG_VERSION).tar.xz
index c17768c1aa74ec4c844465d7a59eada1624dff4a..a46df7d1b1ca1a00d8b0c780eb76a08fea913bee 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2017 OpenWrt.org
+# Copyright (C) 2017 - 2018 OpenWrt.org
 
 START=90
 
@@ -123,6 +123,15 @@ stop_service() {
     timeout=$(($timeout-10))
   done
 
+  [ $retval -ne 1 ] && {
+    $LOGGER Application seems to hang
+    $LOGGER Sending SIGKILL
+    kill -SIGKILL $mypid 2>/dev/null
+    sleep 3
+    pgrep $FS | grep -w $mypid &>/dev/null
+    retval=$?
+  }
+
   [ $retval -ne 1 ] && {
     $LOGGER Failed to stop $FS
     exit 1