[sr-dev] git:master: pkg: updated init script for kamailio debian package

Daniel-Constantin Mierla miconda at gmail.com
Sun Mar 6 14:54:01 CET 2011


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sun Mar  6 13:51:41 2011 +0100

pkg: updated init script for kamailio debian package

- extra checks after starting kamailio
- patch by Klaus Darilion, FS#113

---

 pkg/kamailio/deb/debian/kamailio.init |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/pkg/kamailio/deb/debian/kamailio.init b/pkg/kamailio/deb/debian/kamailio.init
index e5f50fc..dff6e5d 100644
--- a/pkg/kamailio/deb/debian/kamailio.init
+++ b/pkg/kamailio/deb/debian/kamailio.init
@@ -124,8 +124,16 @@ case "$1" in
 
 	echo -n "Starting $DESC: $NAME"
 	start-stop-daemon --start --quiet --pidfile $PIDFILE \
-		--exec $DAEMON -- $OPTIONS || echo -n " already running"
-	echo "."
+		--exec $DAEMON -- $OPTIONS || if [ ! -r "$PIDFILE" ]; then
+			echo " error, failed to start."
+			exit 1
+		elif read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
+			echo -n " already running"
+			echo "."
+		else
+			echo " error, failed to start ($PIDFILE exists)."
+			exit 1
+		fi
 	;;
   stop)
 	echo -n "Stopping $DESC: $NAME"




More information about the sr-dev mailing list