From 46c93bb54e942e45b7e4b78b836b39e827fe547d Mon Sep 17 00:00:00 2001 From: swysor Date: Fri, 27 Oct 2017 14:23:56 -0400 Subject: [PATCH 1/4] Fixed this not allowing the setting to be a comment --- system/sbin/kazoo-kamailio | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/system/sbin/kazoo-kamailio b/system/sbin/kazoo-kamailio index af4d6ef..e9333f8 100755 --- a/system/sbin/kazoo-kamailio +++ b/system/sbin/kazoo-kamailio @@ -32,7 +32,7 @@ prepare() { rm -rf ${PID_FILE} fi if ram_disk_enabled; then - if ! mount_point_exists; then + if ! mount_point_exists; then if [ -f /etc/kazoo/kamailio/kazoo.db ]; then mv /etc/kazoo/kamailio/db /etc/kazoo/kamailio/db-backup fi @@ -41,7 +41,7 @@ prepare() { cp -a /etc/kazoo/kamailio/db-backup/* /etc/kazoo/kamailio/db/ fi fi - fi + fi if [ ! -f /etc/kazoo/kamailio/db/kazoo.db ]; then KazooDB -init /etc/kazoo/kamailio/kazoodb.sql fi @@ -50,12 +50,12 @@ prepare() { } 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 $? } mount_point_exists() { - mount | grep /etc/kazoo/kamailio/db &> /dev/null + mount | grep /etc/kazoo/kamailio/db &> /dev/null return $? } @@ -72,10 +72,10 @@ start() { exec "$@" else 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 RETVAL=$? - + if [ ${RETVAL} -ne 0 ]; then echo "Failed to start Kamailio!" RETVAL=1 @@ -85,7 +85,7 @@ start() { stop() { killall ${BIN_FILE} RETVAL=$? - if mount_point_exists; then + if mount_point_exists; then if [ -f /etc/kazoo/kamailio/kazoo.db ]; then mv /etc/kazoo/kamailio/db /etc/kazoo/kamailio/db-backup fi @@ -101,14 +101,14 @@ reset-restart() { cd /etc/kazoo/kamailio/dbtext/ 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 - 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 * From c7d97d3215990c0d40f869671ed8367f5999a752 Mon Sep 17 00:00:00 2001 From: swysor Date: Fri, 27 Oct 2017 17:18:50 -0400 Subject: [PATCH 2/4] Heredoc to prevent the prompt when initting the db --- system/sbin/kazoo-kamailio | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/sbin/kazoo-kamailio b/system/sbin/kazoo-kamailio index e9333f8..cf59b79 100755 --- a/system/sbin/kazoo-kamailio +++ b/system/sbin/kazoo-kamailio @@ -43,7 +43,7 @@ prepare() { fi fi if [ ! -f /etc/kazoo/kamailio/db/kazoo.db ]; then - KazooDB -init /etc/kazoo/kamailio/kazoodb.sql + init_database fi chown -R ${USER} /etc/kazoo/kamailio/db RETVAL=$? @@ -59,6 +59,10 @@ mount_point_exists() { return $? } +init_database() { + KazooDB -init /etc/kazoo/kamailio/kazoodb.sql < Date: Fri, 27 Oct 2017 17:26:12 -0400 Subject: [PATCH 3/4] two tabs? one tab --- system/sbin/kazoo-kamailio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/sbin/kazoo-kamailio b/system/sbin/kazoo-kamailio index cf59b79..a987a02 100755 --- a/system/sbin/kazoo-kamailio +++ b/system/sbin/kazoo-kamailio @@ -60,7 +60,7 @@ mount_point_exists() { } init_database() { - KazooDB -init /etc/kazoo/kamailio/kazoodb.sql < Date: Fri, 27 Oct 2017 18:04:03 -0400 Subject: [PATCH 4/4] Removed heredoc and use the < option instead --- system/sbin/kazoo-kamailio | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/system/sbin/kazoo-kamailio b/system/sbin/kazoo-kamailio index a987a02..f042c83 100755 --- a/system/sbin/kazoo-kamailio +++ b/system/sbin/kazoo-kamailio @@ -60,8 +60,7 @@ mount_point_exists() { } init_database() { - KazooDB -init /etc/kazoo/kamailio/kazoodb.sql <