Module: kamailio Branch: master Commit: f06cad16ddd38771f29bfba29161bfa3ec76354f URL: https://github.com/kamailio/kamailio/commit/f06cad16ddd38771f29bfba29161bfa3...
Author: Hugh Waite hughw273@gmail.com Committer: Hugh Waite hughw273@gmail.com Date: 2018-01-04T21:01:08Z
pkg/kamailio/obs: Minor improvements to kamailio.init file
Use $PROG instead of uninitialised $DESC Pass the .cfg file name as a parameter when starting and checking config Use the pidfile when stopping to allow parallel instances
---
Modified: pkg/kamailio/obs/kamailio.init
---
Diff: https://github.com/kamailio/kamailio/commit/f06cad16ddd38771f29bfba29161bfa3... Patch: https://github.com/kamailio/kamailio/commit/f06cad16ddd38771f29bfba29161bfa3...
---
diff --git a/pkg/kamailio/obs/kamailio.init b/pkg/kamailio/obs/kamailio.init index 2cdae7a87d..0d7823637a 100644 --- a/pkg/kamailio/obs/kamailio.init +++ b/pkg/kamailio/obs/kamailio.init @@ -36,7 +36,7 @@ RUN_KAMAILIO=no check_fork () { if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $KAMCFG; then - echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead" + echo "Not starting $PROG: fork=no specified in config file; run /etc/init.d/kamailio debug instead" exit 1 fi } @@ -44,10 +44,10 @@ check_fork () check_kamailio_config () { # Check if kamailio configuration is valid before starting the server - out=$($KAM -c 2>&1 > /dev/null) + out=$($KAM -c $OPTIONS 2>&1 > /dev/null) retcode=$? if [ "$retcode" != '0' ]; then - echo "Not starting $DESC: invalid configuration file!" + echo "Not starting $PROG: invalid configuration file!" echo -e "\n$out\n" exit 1 fi @@ -69,7 +69,7 @@ start() {
stop() { echo -n $"Stopping $PROG: " - killproc $KAM + killproc -p $PID_FILE RETVAL=$? echo [ $RETVAL = 0 ] && rm -f $LOCK_FILE $PID_FILE @@ -81,7 +81,7 @@ if [ -f $DEFAULTS ]; then fi
if [ "$RUN_KAMAILIO" != "yes" ]; then - echo "Kamailio not yet configured. Edit /etc/default/kamailio first." + echo "Kamailio not yet configured. Edit $DEFAULTS first." exit 0 fi
@@ -108,7 +108,7 @@ if [ ! -d $HOMEDIR ]; then chown ${USER}:${GROUP} $HOMEDIR fi
-OPTIONS="-P $PID_FILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP $EXTRA_OPTIONS" +OPTIONS="-f $KAMCFG -P $PID_FILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP $EXTRA_OPTIONS"
# See how we were called.