[Asterisk-Users] Is asterisk that unstable ????

Justin Carlson justin at lach.net
Sat Jan 1 13:27:42 MST 2005


what was wrong with logrotate?

On Thu, 2004-12-30 at 10:57 -0500, Matt Gibson wrote:
> Hi Randy,
> 
> Randy MacKay wrote:
> >>I do about 500 calls per day on average volume and about 750 on heavy
> >>volume and find it necessary to run a logger rotate every other day...
> >>other then that I can go on for a couple weeks until I need a full
> >>reboot.
> >>
> > 
> > 
> > How do you rotate your logs?
> 
> I have made a script to rotate mine, it's a little over complicated, but 
> it works.
> 
> asterisk is run as user, and logs are kept in /var/log/asterisk
> old logs are kept in /var/log/asterisk/old_logs
> 
> 
> crontab for root:
> # this is to rotate asterisk logs daily at 11:58 pm
> 58 23 * * * /etc/asterisk_logr.sh | mail - -s "[asterisk] daily log 
> rotate" root
> 
> 
> asterisk_logr.sh:
> #!/bin/sh
> #Rotates log files for asterisk
> 
> #variables
> today=`/bin/date +%m%d%Y`
> chown="/bin/chown"
> mv="/bin/mv"
> ls='/bin/ls -sh'
> 
> #tell asterisk to do its thing
> echo
> echo "---------------"
> echo "#  MESSAGES   #"
> echo "---------------"
> /usr/sbin/asterisk -rx "logger rotate"
> echo
> # sleepy sleepy
> #sleep 2
> 
> #set shit up
> sourcef1="/var/log/asterisk/queue_log.0"
> sourcef2="/var/log/asterisk/event_log.0"
> sourcef3="/var/log/asterisk/asterisk_norm.log.0"
> sourcef4="/var/log/asterisk/asterisk_debug.log.0"
> sourcef5="/var/log/asterisk/screenlog.0"
> destf1="/var/log/asterisk/old_logs/queue_log.$today"
> destf2="/var/log/asterisk/old_logs/event_log.$today"
> destf3="/var/log/asterisk/old_logs/asterisk_norm.log.$today"
> destf4="/var/log/asterisk/old_logs/asterisk_debug.log.$today"
> destf5="/var/log/asterisk/old_logs/screenlog.0.$today"
> 
> #moveem to dest dir
> echo "---------------"
> echo "#  QUEUE LOG  #"
> echo "---------------"
> if [ -f $sourcef1 ]; then
>          $mv $sourcef1 $destf1
>          echo "- rotated $sourcef1 to $destf1"
>          $chown root:wheel $destf1
>          echo "- $destf1 file attributes set"
>          echo "- file size:" `$ls $destf1`
>          echo
> else
>          echo "- no queue log to rotate"
>          echo "- no queue log to give permissions to"
>          echo
> fi
> 
> echo "---------------"
> echo "#  EVENT LOG  #"
> echo "---------------"
> if [ -f $sourcef2 ]; then
>          $mv $sourcef2 $destf2
>          echo "- rotated $sourcef2 to $destf2"
>          $chown root:wheel $destf2
>          echo "- $destf2 file attributes set"
>          echo "- file size:" `$ls $destf2`
>          echo
> else
>          echo "- no event log to rotate"
>          echo "- no event log to give permissions to"
>          echo
> fi
> 
> echo "---------------"
> echo "#   NORM LOG  #"
> echo "---------------"
> if [ -f $sourcef3 ]; then
>          $mv $sourcef3 $destf3
>          echo "- rotated $sourcef3 to $destf3"
>          $chown root:wheel $destf3
>          echo "- $destf3 file attributes set"
>          echo "- file size:" `$ls $destf3`
>          echo
> else
>          echo "no normal log to rotate"
>          echo "no normal log to give permissions to"
>          echo
> fi
> 
> 
> echo "---------------"
> echo "#  DEBUG LOG  #"
> echo "---------------"
> if [ -f $sourcef4 ]; then
>          $mv $sourcef4 $destf4
>          echo "- rotated $sourcef4 to $destf4"
>          $chown root:wheel $destf4
>          echo "- $destf4 file attributes set"
>          echo "- file size:" `$ls $destf4`
>          echo
> else
>          echo "no debug logfile to rotate"
>          echo "no debug log to give permissions to"
>          echo
> fi
> 
> echo "---------------"
> echo "#  SCREEN LOG #"
> echo "---------------"
> if [ -f $sourcef5 ]; then
>          $mv $sourcef5 $destf5
>          echo "- rotated $sourcef5 to $destf5"
>          $chown root:wheel $destf5
>          echo "- $destf5 file attributes set"
>          echo "- file size:" `$ls $destf5`
>          echo
> else
>          echo "no screen logfile to rotate"
>          echo "no screen log to give permissions to"
>          echo
> fi
> 
> 
> 




More information about the asterisk-users mailing list