From f3bb65f461fa169c53dd874171f32f6e88be2223 Mon Sep 17 00:00:00 2001 From: k-paulius Date: Sun, 29 Mar 2015 17:14:37 -0500 Subject: Be more graceful about process termination --- config/freeradius2/freeradius.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'config/freeradius2') diff --git a/config/freeradius2/freeradius.inc b/config/freeradius2/freeradius.inc index 1aed5010..8472ea5e 100644 --- a/config/freeradius2/freeradius.inc +++ b/config/freeradius2/freeradius.inc @@ -76,7 +76,15 @@ if ($pfs_version == "2.2") { } function freeradius_deinstall_command() { - exec("killall -9 radiusd"); + $pidFile = "/var/run/radiusd.pid"; + $i = 0; + + while (isvalidpid($pidFile) && $i < 3) { + $sig = ($i == 2 ? SIGKILL : SIGTERM); + sigkillbypid($pidFile, $sig); + sleep(1); + $i++; + } return; } -- cgit v1.2.3