TT#53525 postinst: use service(8) to identify active kamailio-proxy instance

systemctl(1) (provided by systemd) isn't necessarily available in the
environment yet, e.g. as identified by piuparts tests.

Instead of relying on systemctl(1) let's use service(8) from
init-system-helpers (which is an essential package), and while at it
report the exit code of the app_lua reload.

Fixes:

| /var/lib/dpkg/info/lua-ngcp-kamailio.postinst: 7: /var/lib/dpkg/info/lua-ngcp-kamailio.postinst: systemctl: not found

Change-Id: I52cf30d6421f58c77ce1983d95c141d3a331e939
changes/68/27568/3
Michael Prokop 7 years ago
parent ad78a66ec5
commit 85e77cc27a

@ -4,9 +4,10 @@ set -e
case "$1" in
configure)
if [ "$(systemctl is-active kamailio-proxy)" = "active" ] ; then
ngcp-sercmd proxy app_lua.reload 0 || true
echo "Kamailio proxy module 'app_lua' reloaded"
if service kamailio-proxy status >/dev/null 2>&1 ; then
echo "kamailio-proxy seems to be active, reloading app_lua"
ngcp-sercmd proxy app_lua.reload 0 || RC=$?
echo "Kamailio proxy module 'app_lua' reloaded (exit code: ${RC:-0})"
fi
;;

Loading…
Cancel
Save