Page 1 of 1

A way to delete record files from asterisk server

PostPosted: Wed Oct 08, 2008 12:00 pm
by yasserin
Hi, I'd been having the .cvs problem, I think it is cause when the crontab is trying to delete the old files (log and recordings) from the server , I set that the recordings has to be delete every two days heres the crontabs from it removal task:

### remove old recordings more than 7 days old
24 0 * * * /usr/bin/find /var/spool/asterisk/monitorDONE/ORIG -maxdepth 2 -type f -mtime +2 -print | xargs rm -f

### remove old vicidial logs and asterisk logs more than 2 days old
28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f
29 0 * * * /usr/bin/find /var/log/asterisk -maxdepth 3 -type f -mtime +2 -print | xargs rm -f


I dont know maybe I did something wrong, Or maybe I can setup the mp3 ftp script to delete each file when this is send via ftp to the data server

Can you please tell me if I didi something wrong on the crontab and how I can modify the script to delete immediately when the record is send via ftp (if this can be done)

PostPosted: Wed Oct 08, 2008 2:32 pm
by mflorell
The recording transfer scripts do not delete files.

What exactly is a ".cvs problem"?

PostPosted: Mon Oct 13, 2008 1:12 pm
by yasserin
Every two days I receive a his error

Sep 25 19:08:01 WARNING[3276]: res_agi.c:210 launch_netscript: Connect to 'agi://127.0.0.1:4577/call_log' failed: Connection refused
== Spawn extension (default, 447511202, 1) exited non-zero on 'SIP/3047-b78541f0'
Sep 25 19:08:01 ERROR[3276]: cdr_csv.c:237 csv_log: Unable to re-open master file /var/log/asterisk//cdr-csv//Master.csv : Read-only file system
Sep 25 19:08:01 ERROR[3276]: cdr_custom.c:129 custom_log: Unable to re-open master file /var/log/asterisk/cdr-custom/Master.csv : Read-only file system


I believe this is cause for the logs and record delete task, or maybe not... but I need to know if theres a way to delete the old ORIG files so my server do not full the HD with copies of files that has been already send to another server via FTP

PostPosted: Mon Oct 13, 2008 6:25 pm
by mflorell
This will remove old recordings from ORIG after 7 days(from the SCRATCH_INSTALL doc):
24 0 * * * /usr/bin/find /var/spool/asterisk/monitorDONE/ORIG -maxdepth 1 -type f -mtime +7 -print | xargs rm -f

Re: A way to delete record files from asterisk server

PostPosted: Tue Oct 14, 2008 8:44 am
by yasserin
Yeah I know, I change it to every 2 days heres my crontab:

### remove old recordings more than 7 days old
24 0 * * * /usr/bin/find /var/spool/asterisk/monitorDONE/ORIG -maxdepth 2 -type f -mtime +2 -print | xargs rm -f


I dont know If I did it right, I change the 7 for 2, Thats why I believe that it is causing me the master.cvs problem cause it is happening to me also every two days. Also If I run manually the
/usr/bin/find /var/spool/asterisk/monitorDONE/ORIG -maxdepth 2 -type f -mtime +2 -print | xargs rm -f
It gives me the above problem.

Is there another way to delete the record one by one when it is sent to my ftp server???

Thanks by the way Matt for all the support

PostPosted: Tue Oct 14, 2008 11:46 am
by mflorell
That command should have nothing to do with your asterisk logs.

To delete files upon upload you would need to add a rm line to the FTP audio script.

PostPosted: Tue Oct 14, 2008 12:05 pm
by yasserin
But theoretically this is all right???
/usr/bin/find /var/spool/asterisk/monitorDONE/ORIG -maxdepth 2 -type f -mtime +2 -print | xargs rm -f
To erase every two days LL THE ORIG RECORDS???

PostPosted: Tue Oct 14, 2008 6:36 pm
by mflorell
That command will erase recordings older than two days old.