Help with automating a bash script

Hi Guys,

There are some emails going deferred as we got some new IP's from our ISP. So I was trying to manually copy the deferred mail and forward it to our sales team so that they can contact our client. I am new to this script thing, but luckily I was able to write the code to extract the data I needed. But I need to automate the process, if you guys can help-

# Copy the deferred mails to a specific folder
cp `grep -rl 'abc@example.com' /var/spool/postfix/deferred` /opt/example

# Read the deferred mail id's (here is /opt/example/1FAAFEB279A for example)

postcat -q 1FAAFEB279A | grep -e Date: -e To: -e Cc: -e Subject: > 1FAAFEB279A.ex

mailx -s Deferred mail cba@domain.com < 1FAAFEB279A.ex

Advanced Thanks.

MMA

Define automate - if you mean run every hour or something like that -- look into cron and crontab:

Crontab � Quick Reference | Admin's Choice

Once you figure out what you're doing please come back and ask for specifics.