浏览代码

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
Daniel-Constantin Mierla 13 年之前
父节点
当前提交
9430290ad9
共有 2 个文件被更改,包括 14 次插入6 次删除
  1. 7 2
      pkg/kamailio/rpm/kamailio.default
  2. 7 4
      pkg/kamailio/rpm/kamailio.init

+ 7 - 2
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"

+ 7 - 4
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.