[SR-Users] keep Kamailio running

Daniel Tryba d.tryba at pocos.nl
Tue Mar 31 12:05:44 CEST 2015


On Tuesday 31 March 2015 11:15:09 Olle E. Johansson wrote:
> In my view a software that gets segementation faults needs to be fixed
> so that it does not happen. Anything else is workarounds that may
> hide the fact that you have a serious bug. 

That is a good view, but in the meantime you'll have to make sure your 
production servers keep running. 

I use supervisor/sipsak as watchdog to restart if there is no kamailio 
running.

kamcheck to start from supervisor, script keeps running if where is atleast 1 
valid response every 3 tries (about 1 per sec). If 3 consecutive fails, stop 
kamailio (which might fail) and then nuke it from orbit just to be save. 
Script dies and supervisor will restart it, relaunching kamailio.

#!/bin/sh
err=0
/etc/init.d/kamailio start

while [ $err -lt 3 ]
do
        sipsak -s sip:ping at 127.0.0.1 2> /dev/null

        if [ $? -eq 0 ]
        then
                err=0
        else
                err=$(( $err + 1 ))
                date
                echo error count: $err
        fi

        sleep 1
done

/etc/init.d/kamailio stop
killall -9 kamailio




More information about the sr-users mailing list