Script: Weekly Archiving of Call Recordings via Cron
Due to some kind of limitation in how the kernel was compiled (supposedly), we can only have 3,000 files in /var/spool/asterisk/monitor/ before things break down. The only solution I've found is to seperate them out in a directory structure.
eg.)
/var/spool/asterisk/monitor/
/var/spool/asterisk/monitor/2007/jan
/var/spool/asterisk/monitor/2007/feb
...
/var/spool/asterisk/monitor/2007/dec
I know I can schedule weekly cron jobs to move *.* out of the ./monitor/, but how would you tell it to move it to a different directory based on the current month? (Preferrably creating that directory at the same time)
I know there's only a handful of people that have mentioned this problem, but there must be many more that have not posted and worked around it.
Any ideas?
- J
You will have to modify this a bunch, but it will give you the general idea.
#! /bin/bash
# This script creates a snapshot of the data once a month.
# This script selects the Month and rsyncs the active
# directory to the appropriate Month's directory on the Big Hard Drive.
# Author--John Mullinix, Cohutta.Com, Inc.
# Get the day of the week from the date command
dat=`date +%m`
# Convert the number to a verbose day of the week to select the correct
# directory.
case "$dat" in
"01" )
month=JanJul
;;
"02" )
month=FebAug
;;
"03" )
month=MarSep
;;
"04" )
month=AprOct
;;
"05" )
month=MayNov
;;
"06" )
month=JunDec
;;
"07" )
month=JanJul
;;
"05" )
month=MayNov
;;
"06" )
month=JunDec
;;
"07" )
month=JanJul
;;
"08" )
month=FebAug
;;
"09" )
month=MarSep
;;
"10" )
month=AprOct
;;
"11" )
month=MayNov
;;
"12" )
month=JunDec
;;
esac
echo "The Monthly backup at GARMAC started at `date`." > /bin/john/month.txt
rsync -av --delete /home/backup/ /home/$month/ >> /bin/john/month.txt
echo "The Monthly backup at GARMAC finished at `date`." >> /bin/john/month.txt
mail -s "Monthly Backup--Larry Garrett Macon" john@cohutta.com < /bin/john/month.txt


Member Since:
2006-06-01