From 7c9b5198cdcce3a79d389451206326eacdfc7f03 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Caletka?= Date: Sun, 30 Nov 2014 18:55:28 +0100 Subject: [PATCH] aiccu: Issue aiccu stop only when aiccu is running When AICCU is not running, running 'aiccu stop' results in unnecessary communications with SixXS servers. Signed-off-by: Ondrej Caletka --- ipv6/aiccu/files/aiccu.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ipv6/aiccu/files/aiccu.sh b/ipv6/aiccu/files/aiccu.sh index 89c8122199..38d8191f50 100755 --- a/ipv6/aiccu/files/aiccu.sh +++ b/ipv6/aiccu/files/aiccu.sh @@ -89,8 +89,12 @@ proto_aiccu_teardown() { local cfg="$1" local link="aiccu-$cfg" CFGFILE="/var/etc/${link}.conf" - - aiccu stop "$CFGFILE" + PIDFILE="/var/run/${link}.pid" + [ -f "$CFGFILE" -a -f "$PIDFILE" ] && { + local pid="$(cat "$PIDFILE")" + [ -d /proc/$pid -a $(cat /proc/$pid/comm) = "aiccu" ] && \ + aiccu stop "$CFGFILE" + } } proto_aiccu_init_config() { -- 2.30.2