Delete old recordings from server

Hi,

Our current FreePBX drive usage is reaching its total capacity. We are at 96% usage as of today, so I am looking to delete recording files older than 2 years.
I did not find an option at the GUI level, so I guess the only option would be accessing via SSH and deleting the files from there?
I found this command: “find /var/spool/asterisk/monitor/ -type f -mtime +730 -exec rm -f {} ;” but I am not sure if this will work or will mess anything else up.
Would you be able to recommend the best way of deleting these old recordings and keep anything other than 2 years old?

Thank you!

Estefanía

You could first issue
find /var/spool/asterisk/monitor/ -type f -mtime +730 -ls
to see what would be deleted.

Also, take a full backup before the delete; if something goes wrong you can restore it.

Thanks @Stewart1 I will try that.
If I take a full backup, where is that backup stored? Wouldn’t it take the space that I am trying to save?

Thank you!

It would, do you have another linux destination with space?

rsync -av --progess /var/spool/asterisk/ [email protected]:/directoryonthatbox

will get all your monitor files (plus all current legacy backups, vmails and other stuff)

If you ara a windoze guy, I remember something called winscp

I ran that command, but since there are a lot of files I can’t see everything that will be deleted. Is there a way to copy maybe in a text file all of the information that I get when executing this command?

Thank you very much.

find /var/spool/asterisk/monitor/ -type f -mtime +730 -ls >foo.txt

Thanks @Stewart1! Is there a way to download this file?

Sure, you can use sftp (if client is Linux or Mac) or WinSCP (Windows).

Or, have your SSH client log the text to a file.

I use Windows. I will check how to log the text to file via SSH.
Thank you!

Assuming you’re using Putty, try the command line psftp to retrieve the file.

Thanks! I was able to access the file using FileZilla with root user/pwd and the data seemed ok to be deleted so I proceeded with the following command: find /var/spool/asterisk/monitor/ -type f -mtime +730 -exec rm -f {} ;

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.