Need an automated script

Hi,

I need a script to execute below task. As of now I am doing it manually and want it automated.

1)go to below path

cd /path/of/file

check for the availibility of two file as below of the latest date.    

test.week1.data
test.week2.data

Case1. If above files are not present then an exception would come via mail. script halt exceution and exit. 

Case2. If above files are present then script will do following task

Connect to TEST database

run below query

select * from temp_data.

alter trigger CHANGE_DATE_TRG disable;

update temp_data set NEXT_EXPECTED=trunc(sysdate-2), NEXT_APPLICABLE=trunc(sysdate-2) where DATAFEED_APK in ('OTC','OTW');

commit;

alter trigger CHANGE_DATE_TRG enable;

exit 

3)Once Case2 completed we should receive a success message via mail.

Lastly after the completion of only Case2 steps below script will be run

nohup path/of/SCRIPT/feed_cron.sh & 

4) If All activity completed we should get a succesful message as "DATA LOADING STARTS SUCCESFULLY"

It would be best If it is possible to get logs of each activity we performed.

Many thanks in advance. Please help

Other people in these forums will agree with me that it would be much more helpful for us in order to give you a hand (and for you to learn as well) if you tell us what you've already tried, what you seem to be unsure of, what issues are you facing as you go, and so forth.

Yes: search these forums for examples (e.g. shell scripts with SQL embedded within), put together a prototype script with all those commands you have, and post for discussion/help/improvements.

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.