[Asterisk-Users] ZT_CHANCONFIG failed on channel 1 - WAS WORKING!!

Tzafrir Cohen tzafrir at cohens.org.il
Sat Aug 20 08:01:43 MST 2005


On Sun, Aug 21, 2005 at 12:32:06AM +1000, Mark Edwards wrote:
> concur that the best way around this is to perioically restart.

This is ignoring the problem rather than solving it.

If you both rmmod zaptel and restart asterisk, why not simply reboot?
All of those sleeps there produce a nice downtime.

See remarks below.

> 
> FWIW this is my restart script which I invoke from cron in the middle
> of the night...
> 
> #!/bin/bash
> ASTERISK=/usr/sbin/asterisk
> RMMOD=/sbin/rmmod
> MODPROBE=/sbin/modprobe
> ZTCFG=/sbin/ztcfg
> 
> echo "Stopping"
> $ASTERISK -rx "stop when convenient"
> if [ $? == 0 ]; then
> 
>         #let COUNT=0

why do math in shell scripts?

for i in `seq 40`

>         while true; do
>                 echo "waiting for asterisk to stop"
>                 if [ ! -e /var/run/asterisk.pid ]; then
>                         break;
>                 fi

A sudden 'killall -9 asterisk' by someone and that cron job will be in an
endless loop.

>                 sleep 5;
>                 echo "."
>         #       let COUNT=COUNT+1
>         #       if [ $COUNT == 40 ]; then
>         #               break;
>         #       fi
>         done
> 
> fi
> 
> echo unloading modules....
> $RMMOD wctdm
> sleep 5
> $RMMOD zaptel
> sleep 15
> killall -9 mpg123
> echo loading modules
> $MODPROBE zaptel
> sleep 15
> $MODPROBE wctdm
> sleep 15
> $ZTCFG -v
> sleep 5
> echo "Starting...."
> $ASTERISK

-- 
Tzafrir Cohen         | tzafrir at jbr.cohens.org.il | VIM is
http://tzafrir.org.il |                           | a Mutt's  
tzafrir at cohens.org.il |                           |  best
ICQ# 16849755         |                           | friend



More information about the asterisk-users mailing list