Page 1 of 1

SCRIPT DELETE

PostPosted: Tue Jan 29, 2013 11:10 pm
by ruben23
Multi Server- 2DBRelication M/S(HA,HearBeat/MON),Web(Proxmox_VMs-LoadBalance),3-telephony
ASterisk 1.4.27-vici
Dahdi-current
2.4 svntrunk
Ubuntu server 10.04 LTS
Scracth Install
VERSION: 2.6
© 2012 ViciDial Group

Hi guys any have idea this script is not performing and running somehow to clean up recordings:

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


any idea how modification to make it work somehow.Thanks

Re: SCRIPT DELETE

PostPosted: Tue Jan 29, 2013 11:38 pm
by williamconley
what makes you believe it is not working?

Re: SCRIPT DELETE

PostPosted: Wed Jan 30, 2013 12:41 am
by ruben23
@ williamconley

my recordings are increasing its size with same level of call rate and also the dates suppose to be deleted are still available on that directory.

Re: SCRIPT DELETE

PostPosted: Wed Jan 30, 2013 1:04 am
by williamconley
your recordings are increasing in size: can you demonstrate this? also remember that this command only deletes the recordings from the orig folder, because they are redundant. there are recordings in other folders that are not deleted and that will cause the monitorDONE folder to continually increase until you make a change to delete/move, etc the other folders in monitorDONE.

How old are the files in the /orig/ folder? At most, how many days?

Re: SCRIPT DELETE

PostPosted: Wed Jan 30, 2013 2:12 am
by ruben23
@williamconley

Yes, my ORIG directory did increased in size and my MP3 are somehow NFS share to my NAS server, so the problem only is my ORIG file which i intend to be maintained by that cronjobs command..i see files on my ORIG month old already suppost it would clean up every 5 days old.

Re: SCRIPT DELETE

PostPosted: Wed Jan 30, 2013 5:15 am
by DomeDan
Start by log in as root and check your system mail with the command "mail", because if theres errors from that command they will be there
or you can just run the command in question and see what the output is.

I had a problem when that command failed because a few files had space in their name,
I added --delimiter=\\n to the xargs command and then it worked with those files, I also posted a patch to the issue tracker to prevent agents to add space to phone_number

this is the command you can run if you have some files with space in their name:
/usr/bin/find /var/spool/asterisk/monitorDONE/ORIG/ -maxdepth 2 -type f -mtime +5 -print | xargs --delimiter=\\n rm -f
but you might want to find them first if they havent been converted and archieved because some other command failed because of the space

Re: SCRIPT DELETE

PostPosted: Wed Jan 30, 2013 2:33 pm
by williamconley
tail -500 /var/log/messages

and

tail -500 /var/mail/root

can both be used to find failures in cron executions

it can also be helpful to simply copy the command and execute it yourself to see if / why it fails.

Re: SCRIPT DELETE

PostPosted: Wed Jan 30, 2013 7:30 pm
by ruben23
@ williamconley


i tried running the script directly :

/usr/bin/find /var/spool/asterisk/monitorDONE/ORIG/ -maxdepth 2 -type f -mtime +7 -print | xargs rm -f

Just blank screen nothing happens back to the directory i execute the command same as the modified one you have

/usr/bin/find /var/spool/asterisk/monitorDONE/ORIG/ -maxdepth 2 -type f -mtime +5 -print | xargs --delimiter=\\n rm -f


Ill try to look into the logs you said.Thanks

Re: SCRIPT DELETE

PostPosted: Thu Jan 31, 2013 3:25 am
by DomeDan
that's the result when there was no files to be found with that criteria.
check what you got in the ORIG directory, list the 10 oldest files for example:
ls -ltr /var/spool/asterisk/monitorDONE/ORIG/ | head

Re: SCRIPT DELETE

PostPosted: Thu Jan 31, 2013 6:56 pm
by ruben23
Code: Select all
root@opendialdvo:~# ls -ltr /var/spool/asterisk/monitorDONE/ORIG/ | head


total 134272456
-rw-r--r-- 1 root root   408364 2013-01-25 06:37 20130125-193652_81046751_halojado_CAPITALH-all.wav
-rw-r--r-- 1 root root  1319404 2013-01-25 06:37 20130125-193555_81046749_halojado_CAPITALH-all.wav
-rw-r--r-- 1 root root  1049004 2013-01-25 06:37 20130125-193612_81046750_halojado_CAPITALH-all.wav
-rw-r--r-- 1 root root   676204 2013-01-25 06:37 20130125-193640_96269115_NSUCAYRE_AVISHSPR-all.wav
-rw-r--r-- 1 root root  1302124 2013-01-25 06:37 20130125-193601_96269072_NSUCAYRE_AVISHSPR-all.wav
-rw-r--r-- 1 root root   739244 2013-01-25 06:37 20130125-193641_97373601_clabita_AVISHS-all.wav
-rw-r--r-- 1 root root  1667884 2013-01-25 06:37 20130125-193543_94899058_clabita_AVISHS-all.wav
-rw-r--r-- 1 root root  1396844 2013-01-25 06:37 20130125-193601_90062357_agilves_AVISHSPR-all.wav
-rw-r--r-- 1 root root  1185004 2013-01-25 06:37 20130125-193615_81051225_sfenol_CAPITALH-all.wav



@ DomeDan Thats the output..Thanks

Re: SCRIPT DELETE

PostPosted: Thu Jan 31, 2013 7:33 pm
by williamconley
well, those are very recent files. looks like the delete process is doing it's job.

test with

/usr/bin/find /var/spool/asterisk/monitorDONE/ORIG/ -maxdepth 2 -type f -mtime +3 -print | xargs rm -f

and see if it deletes them to a more recent threshold. but it looks like it's workin'

Re: SCRIPT DELETE

PostPosted: Sun Feb 10, 2013 7:41 pm
by ruben23
@ williamconley


Yes coz i already backup it manually using only WINSCP, which is a very lagged process. any other chance we can make this script work..? Thanks


Ruben

Re: SCRIPT DELETE

PostPosted: Sun Feb 10, 2013 8:10 pm
by williamconley
i'm not sure i understand the question. it looks like the script is already working. what makes you think it isn't?