[Pkg-voip-commits] [kamailio] 01/01: Use new vars to configure shared and private memory and path for the configuration file

Victor Seva Lopez maniac-guest at moszumanska.debian.org
Fri Feb 21 10:33:15 UTC 2014


This is an automated email from the git hooks/post-receive script.

maniac-guest pushed a commit to branch master
in repository kamailio.

commit 6c3a95fa8b962f06ec3acf31d7d1b2a9d227bdd2
Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Date:   Fri Feb 21 09:46:36 2014 +0100

    Use new vars to configure shared and private memory and path
    for the configuration file
---
 debian/kamailio.default |  9 +++++++--
 debian/kamailio.init    | 19 ++++++++++++-------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/debian/kamailio.default b/debian/kamailio.default
index 2e7a03c..0cfc8c8 100644
--- a/debian/kamailio.default
+++ b/debian/kamailio.default
@@ -11,8 +11,13 @@
 # Group to run as
 #GROUP=kamailio
 
-# Amount of memory to allocate for the running Kamailio server (in Mb)
-#MEMORY=64
+# Amount of shared and private memory to allocate
+# for the running Kamailio server (in Mb)
+#SHM_MEMORY=64
+#PKG_MEMORY=4
+
+# Config file
+#CFGFILE=/etc/kamailio/kamailio.cfg
 
 # Enable the server to leave a core file when it crashes.
 # Set this to 'yes' to enable Kamailio to leave a core file when it crashes
diff --git a/debian/kamailio.init b/debian/kamailio.init
index 7c08563..1f8f796 100644
--- a/debian/kamailio.init
+++ b/debian/kamailio.init
@@ -21,18 +21,21 @@ DESC="Kamailio SIP server"
 HOMEDIR=/var/run/kamailio
 PIDFILE=$HOMEDIR/$NAME.pid
 DEFAULTS=/etc/default/kamailio
+CFGFILE=/etc/kamailio/kamailio.cfg
 RUN_KAMAILIO=no
 USER=kamailio
 GROUP=kamailio
-# Amount of memory to allocate for the running Kamailio server (in Mb)
-MEMORY=64
+# Amount of shared and private memory to allocate
+# for the running Kamailio server (in Mb)
+SHM_MEMORY=64
+PKG_MEMORY=4
 DUMP_CORE=no
 
 # Do not start kamailio if fork=no is set in the config file
 # otherwise the boot process will just stop
 check_fork ()
 {
-    if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" /etc/kamailio/kamailio.cfg; then
+    if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then
 	log_failure_msg "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead"
 	exit 0
     fi
@@ -42,7 +45,7 @@ check_kamailio_config ()
 {
 	# Check if kamailio configuration is valid before starting the server
 	set +e
-	out=$($DAEMON -c 2>&1 > /dev/null)
+	out=$($DAEMON -f $CFGFILE -M $PKG_MEMORY -c 2>&1 > /dev/null)
 	retcode=$?
 	set -e
 	if [ "$retcode" != '0' ]; then
@@ -91,10 +94,12 @@ fi
 
 set -e
 
-MEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))
+SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`))
+PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`))
 [ -z "$USER" ]  && USER=kamailio
 [ -z "$GROUP" ] && GROUP=kamailio
-[ $MEMORY -le 0 ] && MEMORY=32
+[ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64
+[ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4
 
 if test "$DUMP_CORE" = "yes" ; then
     # set proper ulimit
@@ -112,7 +117,7 @@ if [ ! -d $HOMEDIR ]; then
     mkdir -p $HOMEDIR
 fi
 
-OPTIONS="-P $PIDFILE -m $MEMORY -u $USER -g $GROUP"
+OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
 
 case "$1" in
   start|debug)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/kamailio.git



More information about the Pkg-voip-commits mailing list