Module: sip-router
Branch: master
Commit: 9430290ad91ca775bb18f54e70308917ce1e790a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9430290…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Sep 18 09:18:52 2012 +0200
pkg/kamailio/rpm: added option to set pkg memory size for init.d script
- split of MEMORY parameter to SHM_MEMORY and PKG_MEMORY
- EXTRA_OPTIONS variable to add other command line parameters
---
pkg/kamailio/rpm/kamailio.default | 9 +++++++--
pkg/kamailio/rpm/kamailio.init | 11 +++++++----
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/pkg/kamailio/rpm/kamailio.default b/pkg/kamailio/rpm/kamailio.default
index d962311..90e6ca7 100644
--- a/pkg/kamailio/rpm/kamailio.default
+++ b/pkg/kamailio/rpm/kamailio.default
@@ -11,8 +11,11 @@ USER=kamailio
# Group to run as
GROUP=kamailio
-# Amount of memory to allocate for the running Kamailio server (in Mb)
-MEMORY=64
+# Amount of shared memory to allocate for the running Kamailio server (in Mb)
+SHM_MEMORY=64
+
+# Amount of private memory to allocate for the running Kamailio server (in Mb)
+PKG_MEMORY=4
# 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
@@ -23,3 +26,5 @@ MEMORY=64
# init file for an example configuration.
DUMP_CORE=no
+# Add extra command line parameters in the EXTRA_OPTIONS variable
+# EXTRA_OPTIONS="-a no"
diff --git a/pkg/kamailio/rpm/kamailio.init b/pkg/kamailio/rpm/kamailio.init
index 93742db..ff6f701 100644
--- a/pkg/kamailio/rpm/kamailio.init
+++ b/pkg/kamailio/rpm/kamailio.init
@@ -13,6 +13,7 @@
. /etc/rc.d/init.d/functions
KAM=/usr/sbin/kamailio
+KAMCFG=/etc/kamailio/kamailio.cfg
PROG=kamailio
PID_FILE=/var/run/kamailio.pid
LOCK_FILE=/var/lock/subsys/kamailio
@@ -25,7 +26,7 @@ RUN_KAMAILIO=no
# 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.*" $KAMCFG; then
echo "Not starting $DESC: fork=no specified in config file; run
/etc/init.d/kamailio debug instead"
exit 1
fi
@@ -76,10 +77,12 @@ if [ "$RUN_KAMAILIO" != "yes" ]; then
fi
-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=32
+[ $PKG_MEMORY -le 0 ] && PKG_MEMORY=32
if test "$DUMP_CORE" = "yes" ; then
# set proper ulimit
@@ -92,7 +95,7 @@ if test "$DUMP_CORE" = "yes" ; then
# echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
fi
-OPTIONS="-P $PID_FILE -m $MEMORY -u $USER -g $GROUP"
+OPTIONS="-P $PID_FILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP
$EXTRA_OPTIONS"
# See how we were called.