Results 1 to 3 of 3
I would like to create a script that will run every day and save all the messages in the inbox and save them to a file then delete the old ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-09-2012 #1
bash script - save mailbox messages.
I would like to create a script that will run every day and save all the messages in the inbox and save them to a file then delete the old messages.
Right now I am doing this manually and would like this automated. This is how I am doing it now.
I go to my mail archive folder and type:
> s 1-### mbox.temp###
> d 1-###
Now if the number of messages were the same everyday then I would be able to do this a lot easier. Since I dont know if there is any wild cards I could use for the total number of messages does anyone know another way to do this?
- 04-14-2012 #2
- Join Date
- May 2011
- Central FL
#!/bin/sh cp mbox mbox.`date +%F` && gzip mbox.`date +%F` && : > mbox
Last edited by dayid; 04-14-2012 at 02:11 AM. Reason: clarify
- 07-27-2012 #3
well I know this is old but I figured out how to do it. It was so simple I feel bad that I didn't think of it sooner. The good new is I have automated this process and removed it from my daily tasks.
first i run
cp /var/spool/mail/<username> newmail.file
then I run