Jake Vickers wrote:
senthil vel wrote:
Dear Jack,

        Thanks a ton for your advice. I have developed a simple script
to do that.

#!/bin/bash
find /home/vpopmail/domains/test.com/test/Maildir/new -type f -print0
| xargs -0 grep -l 'Subject: The Subject of the mail' > temp.txt
tobmoved=`cat temp.txt`
mv "$tobmoved" /home/vpopmail/domains/test.com/test1/Maildir/cur



And put it in Cron.

My crontab -e looks like this

* 4 * * * sh /root/mail1.sh

At morning 4 oclock the script will run.

 It is working fine. My little hesitation is the temp.txt. Can we do
the same without any temp file? Can you help on this?

It can be done, but it would be easier just to add:
rm -f temp.txt

to the script.


From qtp-menu, here's a nice way to handle temp files:
# set a temp file for the working scratch. $$ is the current shell ID.
tempfile=$(tempfile 2>/dev/null) || tempfile=/tmp/$me.$$
# make sure the tempfile is deleted when we're done
trap "rm -f $tempfile" 0 1 2 5 15

--
-Eric 'shubes'


---------------------------------------------------------------------
    QmailToaster hosted by: VR Hosted <http://www.vr.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to