|
@@ -1,4 +1,4 @@
|
|
-#!/bin/bash
|
|
|
|
|
|
+#!/bin/sh
|
|
# test cfgutils and pv module
|
|
# test cfgutils and pv module
|
|
|
|
|
|
# Copyright (C) 2008 1&1 Internet AG
|
|
# Copyright (C) 2008 1&1 Internet AG
|
|
@@ -19,20 +19,35 @@
|
|
# along with this program; if not, write to the Free Software
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
-source include/common
|
|
|
|
-source include/require
|
|
|
|
|
|
+. include/common
|
|
|
|
+. include/require.sh
|
|
|
|
|
|
if ! (check_netcat && check_kamailio); then
|
|
if ! (check_netcat && check_kamailio); then
|
|
exit 0
|
|
exit 0
|
|
fi;
|
|
fi;
|
|
|
|
|
|
-if [ -e core ] ; then
|
|
|
|
- echo "core file found, not run"
|
|
|
|
- exit 0
|
|
|
|
|
|
+if ( have_netcat_quit_timer_patch ); then
|
|
|
|
+ NCOPTS='-q 1'
|
|
|
|
+else
|
|
|
|
+ NCOPTS='-w 2'
|
|
fi;
|
|
fi;
|
|
|
|
|
|
CFG=33.cfg
|
|
CFG=33.cfg
|
|
|
|
|
|
|
|
+CORE=$(sysctl kern.corefile 2> /dev/null)
|
|
|
|
+echo $CORE | grep '^kern.corefile: %N\.core' > /dev/null
|
|
|
|
+ret=$?
|
|
|
|
+if [ $ret -eq 0 ] ; then
|
|
|
|
+ CORE='kamailio.core'
|
|
|
|
+else
|
|
|
|
+ CORE='core'
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
+if [ -e $CORE ] ; then
|
|
|
|
+ echo "core file found, not run"
|
|
|
|
+ exit 0
|
|
|
|
+fi;
|
|
|
|
+
|
|
cp $CFG $CFG.bak
|
|
cp $CFG $CFG.bak
|
|
|
|
|
|
ulimit -c unlimited
|
|
ulimit -c unlimited
|
|
@@ -43,23 +58,24 @@ ret=$?
|
|
sleep 1
|
|
sleep 1
|
|
|
|
|
|
if [ $ret -eq 0 ] ; then
|
|
if [ $ret -eq 0 ] ; then
|
|
- $CTL mi check_config_hash | grep "The actual config file hash is identical to the stored one." >/dev/null
|
|
|
|
|
|
+ $CTL rpc cfgutils.check_config_hash | grep '"result":"Identical hash"' > /dev/null
|
|
ret=$?
|
|
ret=$?
|
|
fi;
|
|
fi;
|
|
|
|
|
|
echo " " >> $CFG
|
|
echo " " >> $CFG
|
|
|
|
+
|
|
if [ $ret -eq 0 ] ; then
|
|
if [ $ret -eq 0 ] ; then
|
|
- $CTL mi check_config_hash | grep "The actual config file hash is identical to the stored one." >/dev/null
|
|
|
|
|
|
+ $CTL rpc cfgutils.check_config_hash | grep '"result":"Identical hash"' > /dev/null
|
|
ret=$?
|
|
ret=$?
|
|
fi
|
|
fi
|
|
|
|
|
|
if [ ! $ret -eq 0 ] ; then
|
|
if [ ! $ret -eq 0 ] ; then
|
|
# send a message
|
|
# send a message
|
|
- cat register.sip | nc -q 1 -u 127.0.0.1 5060 > /dev/null
|
|
|
|
|
|
+ cat register.sip | nc $NCOPTS -u 127.0.0.1 5060 > /dev/null
|
|
fi
|
|
fi
|
|
|
|
|
|
sleep 1
|
|
sleep 1
|
|
-kill_kamailio
|
|
|
|
|
|
+kill_kamailio 2> /dev/null
|
|
ret=$?
|
|
ret=$?
|
|
|
|
|
|
if [ $ret -eq 0 ] ; then
|
|
if [ $ret -eq 0 ] ; then
|
|
@@ -68,10 +84,10 @@ else
|
|
ret=0
|
|
ret=0
|
|
fi
|
|
fi
|
|
|
|
|
|
-if [ ! -e core ] ; then
|
|
|
|
|
|
+if [ ! -e $CORE ] ; then
|
|
ret=1
|
|
ret=1
|
|
fi
|
|
fi
|
|
-rm -f core
|
|
|
|
|
|
+rm -f $CORE
|
|
mv $CFG.bak $CFG
|
|
mv $CFG.bak $CFG
|
|
|
|
|
|
exit $ret
|
|
exit $ret
|