[asterisk-users] Delete voicemail after couple of days
Steve Edwards
asterisk.org at sedwards.com
Mon Jul 20 12:42:59 CDT 2009
Un-top-posting...
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Tim Nelson
> Sent: Friday, July 17, 2009 5:33 PM
> Write up a small shell script that uses 'find
> /var/spool/asterisk/voicemail/ -mtime +2' for a list of files older than
> two days assuming you want ALL files deleted older than two days. You
> could always grep that output if you only wanted to delete voicemail
> that is not still in the INBOX or elsewhere. Anyways, then use -exec to
> rm the files. If the goal was to remove all files, it might look
> something like this:
>
> #!/bin/bash
> find /var/spool/asterisk/voicemail/ -mtime +2 -exec rm {}\;
>
> Run that from cron once a day/hour/whatever and you're set.
On Mon, 20 Jul 2009, Danny Nicholas wrote:
> Tim, this is a partial solution. The find as written would remove
> greetings, unavailable messages, etc. You would need to add a grep to get
> only msg files.
Skip the grep...
sudo find /var/spool/asterisk/ -mtime +2 -name "msg*" -exec rm {} \;
(Note the space after the closing brace.)
But Carlos had the best answer.
On Fri, 17 Jul 2009, Carlos Chavez wrote:
> I did not catch all the messages on this thread but why not use the
> messages-expire.pl script included in Asterisk for this simple task?
> It will delete and renumber all messages and you can program how many
> days before a message is deleted.
Why re-invent the wheel. This script is way more flexible than a 1-liner.
(Note that Asterisk will renumber the messages for you automagically in
case you decide to cobble up your own script.)
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list