From a11eb4053c1761feb9da3fb02a60e16cb8765db3 Mon Sep 17 00:00:00 2001 From: frankw Date: Thu, 10 Apr 2008 20:45:24 +0000 Subject: [PATCH] Fixed Problem where only worked right when restarted or stopped from same user session git-svn-id: svn://192.168.202.10@829 3d104415-ff17-0410-8863-d5cf3c621b8a --- extras/init.d/vicidial | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/extras/init.d/vicidial b/extras/init.d/vicidial index 3fe41e95..8b9d9f2e 100644 --- a/extras/init.d/vicidial +++ b/extras/init.d/vicidial @@ -267,8 +267,8 @@ rc_reset # considered a success. case "$1" in - start) - echo -n "Starting Vicidial " +start) + echo "Starting Vicidial " ## Start daemon with startproc(8). If this fails ## the return value is set appropriately by startproc. @@ -303,29 +303,29 @@ case "$1" in sleep 2 - $VICI_DIR/ADMIN_keepalive_ALL.pl + $VICI_DIR/ADMIN_keepalive_ALL.pl echo "" - echo -n "Starting Vicidial " + echo "Starting Vicidial " # Remember status and be verbose rc_status -v ;; - stop) +stop) ## Stop daemon with killproc(8) and if this fails ## killproc sets the return value according to LSB. - if /bin/ps | /usr/bin/grep asterisk - then + if /bin/ps -A | /usr/bin/grep asterisk + then echo "Stopping asterisk gracefully (wait 60sec)" $AST_BIN -rx "stop gracefully" 1> /dev/null 2> /dev/null # stop asterisk gracefully sleep 60 - if /bin/ps | /usr/bin/grep asterisk + if /bin/ps -A| /usr/bin/grep asterisk then - echo "Okay it has had long enough ... stopping Asterisk now" - $AST_BIN -rx "stop now" 1> /dev/null 2> /dev/null # stop asterisk now + echo "Okay it has had long enough ... stopping Asterisk now" + $AST_BIN -rx "stop now" 1> /dev/null 2> /dev/null # stop asterisk now fi echo "Asterisk stopped" else @@ -379,7 +379,7 @@ case "$1" in # Remember status and be quiet rc_status ;; - restart) +restart) ## Stop the service and regardless of whether it was ## running or not, start it again. $0 stop @@ -388,8 +388,8 @@ case "$1" in # Remember status and be quiet rc_status ;; - status) - echo -n "Checking for service Vicidial " +status) + echo -n "Checking for service Vicidial " ## Check status with checkproc(8), if process is running ## checkproc will return with exit status 0. @@ -401,13 +401,15 @@ case "$1" in # 4 - service status unknown :-( # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) + /usr/bin/screen -ls + # NOTE: checkproc returns LSB compliant status values. checkproc $AST_BIN # NOTE: rc_status knows that we called this init script with # "status" option and adapts its messages accordingly. rc_status -v ;; - probe) +probe) ## Optional: Probe for the necessity of a reload, print out the ## argument to this init script which is required for a reload. ## Note: probe is not (yet) part of LSB (as of 1.9)