[sr-dev] [tracker] Task opened: Kamailio init script reports falsely "Kamailio already running"

sip-router admin at sip-router.org
Fri Feb 11 19:28:56 CET 2011


A new Flyspray task has been opened.  Details are below. 

User who did this - Klaus Darilion (klaus3000) 

Attached to Project - sip-router
Summary - Kamailio init script reports falsely "Kamailio already running"
Task Type - Bug Report
Category - tools/scripts
Status - New
Assigned To - 
Operating System - All
Severity - Low
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - Hi!

The init script for Debian always reports "Kamailio already running" if Kamailio does not start although the config is correct (e.g. can not bind to socket). IMO we could improve it a bit by checking if Kamailio is really running (at least check for PID file and process).

This is a patch which solves this, feel free to make it nicer.

--- kamailio.orig       2011-02-11 18:55:28.000000000 +0100
+++ kamailio    2011-02-11 19:20:43.000000000 +0100
@@ -124,8 +124,16 @@

        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 3
+               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
        echo -n "Stopping $DESC: $NAME"

More information can be found at the following URL:

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.

More information about the sr-dev mailing list