From b7ce37ba0b8eb3dea50d1283409065dee22f1d2c Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sun, 5 Aug 2018 14:44:40 +0200 Subject: [PATCH] freeswitch-stable: add SIGKILL to init script 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 --- net/freeswitch-stable/Makefile | 2 +- net/freeswitch-stable/files/freeswitch.init | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/net/freeswitch-stable/Makefile b/net/freeswitch-stable/Makefile index 76ce872..09083df 100644 --- a/net/freeswitch-stable/Makefile +++ b/net/freeswitch-stable/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PRG_NAME:=freeswitch PKG_NAME:=$(PRG_NAME)-stable PKG_VERSION:=1.8.1 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_MAINTAINER:=Sebastian Kemper PKG_SOURCE_PROTO:=git diff --git a/net/freeswitch-stable/files/freeswitch.init b/net/freeswitch-stable/files/freeswitch.init index c17768c..a46df7d 100644 --- a/net/freeswitch-stable/files/freeswitch.init +++ b/net/freeswitch-stable/files/freeswitch.init @@ -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 -- 2.30.2