So I have an asterisk <
www.asterisk.org> phone system on centos 5.5 and I came across a script to purge phone recordings 1) less than 15MB in size & 2) older than 14 days but I cannot record it since it complains of various syntax errors. Below is just one of the two scripts.
The most common way of maintaining call recordings is to automate the deletion of recordings that are older than a certain time frame. The following script called OldRecordingDeletion.sh will remove all of the recordings older than 14 days.
#!/bin/bash
# Change this path to reflect your recording storage
# location
RECORDINGS=/var/spool/asterisk/monitor
# Change this number to reflect the maximum age of call
# recordings
RECORDINGEXPIRY=14
# Change this number to reflect the maximum age of the
# deletion logs
LOGEXPIRY=365
# Current date
DATE=`date`
# Delete recordings older than $EXPIRY days
find $RECORDINGS -mtime +$EXPIRY -exec rm -rfv > removal-$DATE.log
# Delete log files older than $LOGEXPRY
find . -mtime +$LOGEXPIRY -exec rm -rf
When I run it, I receive the error:
[root@localhost recordingdeletion]# ./OldRecordingDeletion.sh
./OldRecordingDeletion.sh: line 19: removal-$DATE.log: ambiguous redirect
find: missing argument to `-exec'
Would any of the developers in the house help me understand how to correct this? The path to the recordings is correct and when I open up a log file, it is completely blank.
thanks for any help