[sr-dev] git:master: kamdbctl: check if kamctlrc is in the same folder

Daniel-Constantin Mierla miconda at gmail.com
Sun Oct 5 22:51:24 CEST 2014


Module: sip-router
Branch: master
Commit: bc4792f39a7a0b2ac971f82f01c436d488f2f393
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bc4792f39a7a0b2ac971f82f01c436d488f2f393

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sun Oct  5 10:08:20 2014 +0200

kamdbctl: check if kamctlrc is in the same folder

---

 utils/kamctl/kamdbctl |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index e9249d8..1ecb6fa 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -1,11 +1,12 @@
 #!/bin/bash 
 #
-# $Id$
-#
 # control tool for maintaining Kamailio databases
 #
 #===================================================================
 
+### version for this script
+VERSION='4.2.0'
+
 PATH=$PATH:/usr/local/sbin/
 
 # for testing only, please don't enable this in production environments
@@ -13,6 +14,15 @@ PATH=$PATH:/usr/local/sbin/
 TEST="false"
 
 ### include resource files, if any
+which readlink > /dev/null
+ret=$?
+if [ $ret -eq 0 ] ; then
+	KAMCTLFULLPATH=$(readlink -f "$0")
+	KAMCTLDIRPATH=$(dirname "$KAMCTLFULLPATH")
+	if [ -f $KAMCTLDIRPATH/kamctlrc ]; then
+		. $KAMCTLDIRPATH/kamctlrc
+	fi
+fi
 if [ -f /etc/kamailio/kamctlrc ]; then
 	. /etc/kamailio/kamctlrc
 fi
@@ -30,9 +40,6 @@ if [ $TEST = "true" ]; then
 fi
 
 
-### version for this script
-VERSION='$Revision$'
-
 if [ -z "$MYDIR" ] ; then
 	MYDIR=`dirname $0`
 fi




More information about the sr-dev mailing list