|
|
@ -32,7 +32,7 @@ prepare() { |
|
|
rm -rf ${PID_FILE} |
|
|
rm -rf ${PID_FILE} |
|
|
fi |
|
|
fi |
|
|
if ram_disk_enabled; then |
|
|
if ram_disk_enabled; then |
|
|
if ! mount_point_exists; then |
|
|
|
|
|
|
|
|
if ! mount_point_exists; then |
|
|
if [ -f /etc/kazoo/kamailio/kazoo.db ]; then |
|
|
if [ -f /etc/kazoo/kamailio/kazoo.db ]; then |
|
|
mv /etc/kazoo/kamailio/db /etc/kazoo/kamailio/db-backup |
|
|
mv /etc/kazoo/kamailio/db /etc/kazoo/kamailio/db-backup |
|
|
fi |
|
|
fi |
|
|
@ -41,7 +41,7 @@ prepare() { |
|
|
cp -a /etc/kazoo/kamailio/db-backup/* /etc/kazoo/kamailio/db/ |
|
|
cp -a /etc/kazoo/kamailio/db-backup/* /etc/kazoo/kamailio/db/ |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
fi |
|
|
if [ ! -f /etc/kazoo/kamailio/db/kazoo.db ]; then |
|
|
if [ ! -f /etc/kazoo/kamailio/db/kazoo.db ]; then |
|
|
KazooDB -init /etc/kazoo/kamailio/kazoodb.sql |
|
|
KazooDB -init /etc/kazoo/kamailio/kazoodb.sql |
|
|
fi |
|
|
fi |
|
|
@ -50,12 +50,12 @@ prepare() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ram_disk_enabled() { |
|
|
ram_disk_enabled() { |
|
|
grep -e "^\s*enable_ram_disk\s*=\s*true" /etc/kazoo/kamailio/local.cfg &> /dev/null |
|
|
|
|
|
|
|
|
grep -e "enable_ram_disk = true" /etc/kazoo/kamailio/local.cfg &> /dev/null |
|
|
return $? |
|
|
return $? |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
mount_point_exists() { |
|
|
mount_point_exists() { |
|
|
mount | grep /etc/kazoo/kamailio/db &> /dev/null |
|
|
|
|
|
|
|
|
mount | grep /etc/kazoo/kamailio/db &> /dev/null |
|
|
return $? |
|
|
return $? |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -72,10 +72,10 @@ start() { |
|
|
exec "$@" |
|
|
exec "$@" |
|
|
else |
|
|
else |
|
|
set -- ${BIN_FILE} -f ${CFG_FILE} -m ${SHM_MEMORY} -M ${PKG_MEMORY} -u ${USER} -g ${GROUP} ${EXTRA_OPTIONS} "$@" |
|
|
set -- ${BIN_FILE} -f ${CFG_FILE} -m ${SHM_MEMORY} -M ${PKG_MEMORY} -u ${USER} -g ${GROUP} ${EXTRA_OPTIONS} "$@" |
|
|
runuser -s /bin/bash ${USER} -c "$*" |
|
|
|
|
|
|
|
|
runuser -s /bin/bash ${USER} -c "$*" |
|
|
fi |
|
|
fi |
|
|
RETVAL=$? |
|
|
RETVAL=$? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${RETVAL} -ne 0 ]; then |
|
|
if [ ${RETVAL} -ne 0 ]; then |
|
|
echo "Failed to start Kamailio!" |
|
|
echo "Failed to start Kamailio!" |
|
|
RETVAL=1 |
|
|
RETVAL=1 |
|
|
@ -85,7 +85,7 @@ start() { |
|
|
stop() { |
|
|
stop() { |
|
|
killall ${BIN_FILE} |
|
|
killall ${BIN_FILE} |
|
|
RETVAL=$? |
|
|
RETVAL=$? |
|
|
if mount_point_exists; then |
|
|
|
|
|
|
|
|
if mount_point_exists; then |
|
|
if [ -f /etc/kazoo/kamailio/kazoo.db ]; then |
|
|
if [ -f /etc/kazoo/kamailio/kazoo.db ]; then |
|
|
mv /etc/kazoo/kamailio/db /etc/kazoo/kamailio/db-backup |
|
|
mv /etc/kazoo/kamailio/db /etc/kazoo/kamailio/db-backup |
|
|
fi |
|
|
fi |
|
|
@ -101,14 +101,14 @@ reset-restart() { |
|
|
cd /etc/kazoo/kamailio/dbtext/ |
|
|
cd /etc/kazoo/kamailio/dbtext/ |
|
|
stop |
|
|
stop |
|
|
|
|
|
|
|
|
head -n1 active_watchers > active_watchers.tmp |
|
|
|
|
|
mv -f active_watchers.tmp active_watchers |
|
|
|
|
|
|
|
|
head -n1 active_watchers > active_watchers.tmp |
|
|
|
|
|
mv -f active_watchers.tmp active_watchers |
|
|
|
|
|
|
|
|
head -n1 watchers > watchers.tmp |
|
|
head -n1 watchers > watchers.tmp |
|
|
mv -f watchers.tmp watchers |
|
|
|
|
|
|
|
|
mv -f watchers.tmp watchers |
|
|
|
|
|
|
|
|
head -n1 presentity > presentity.tmp |
|
|
|
|
|
mv -f presentity.tmp presentity |
|
|
|
|
|
|
|
|
head -n1 presentity > presentity.tmp |
|
|
|
|
|
mv -f presentity.tmp presentity |
|
|
|
|
|
|
|
|
chown kamailio:daemon * |
|
|
chown kamailio:daemon * |
|
|
|
|
|
|
|
|
|