only run cronjob when asteriks voip gives 0 on channels
hello,
i have set up a asteriks voip and add a cronjob to send the output of a specific command to my email after the cronjob shutdown -r now. now i need a script that prevents the cronjob (reboot and email) from being executed if this command: asteriks -rx "show channels" states active connections(to prevent active calls being terminated) the output of the command above(asteriks -rx "show channels") is as follows(if there are no calls) Code:
channel location state application(data) hope some 1 can help me with this regards, |
The easy way is to write a script. Something like this.
Then run this script from the cronjob. When the script is run, it waits until after both channels are clear before rebooting. #!/bin/sh # @(#) reboot-voip reboot voip server after calls clear until [ `asterisk -rx "show channels" | grep "^0 act" | wc -l` -eq 2 ] do sleep 5 done shutdown -r now |
All times are GMT -5. The time now is 11:38 AM. |