Need an automated script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need an automated script
# 1  
Old 09-23-2013
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.

Code:
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

Code:
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
# 2  
Old 09-23-2013
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.
# 3  
Old 09-23-2013
Yes: search these fora 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.
# 4  
Old 09-23-2013
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with Automated Shell Script

Hello, how can I write a shell script that looks in running processes and if there isn't a process name containing 91.34.124.35 then execute a file in a certain place. I know PHP, in PHP I could do a preg_match_all but I don't know how to do it in shell. (5 Replies)
Discussion started by: nottingham
5 Replies

2. Shell Programming and Scripting

Automated log script

Hello, I am scripting noob but I need little monitoring script. It will be very good if you can help me. What I need: Script will login via ssh to another machine (ssh -l user ipadress), make top command and log first row + machine ip. It should monitor like 10 machines. Script should run... (1 Reply)
Discussion started by: Biosko
1 Replies

3. UNIX for Dummies Questions & Answers

Automated backup script

I want to create an automated backup script that will copy files to different directories for different days. I will use a detachable USB drive, under SCO 5.0.7. I am very new to Unix, and will require most of the script. Thanks (5 Replies)
Discussion started by: Bennieinbots
5 Replies

4. Shell Programming and Scripting

sftp automated script

HI, Can anyone has automated sftp script? I want to upload one file from one server to other. Could anyone help us? (3 Replies)
Discussion started by: javeed7
3 Replies

5. Shell Programming and Scripting

Automated SFTP script

Hi All, I am writing an automated SFTP script to xfer files. I am able to do sftp in batch mode and it is working absolutely fine. The problem is that on redirecting the output of SFTP session to some file, it is not writing about the status of SFTP operation. All i can see in output file is :... (6 Replies)
Discussion started by: aggar_y
6 Replies

6. Shell Programming and Scripting

i want automated script

echo "Enter your choice :\c" read num case $num in . 1)"${TEST_HOME}"/ctrl_extract.ksh 1 ;; 2)"${TEST_HOME}"/ctrl_extract.ksh 2 ;;3)"${TEST_HOME}"/ctrl_extract.ksh 3 ;; 4)"${TEST_HOME}"/ctrl_extract.ksh 4 ;; 5)"${TEST_HOME}"/ctrl_extract.ksh 5 ;;... (3 Replies)
Discussion started by: arghya_owen
3 Replies

7. Shell Programming and Scripting

automated sftp script

Ok, I am sure this has been beat like a dead horse, but I an trying "anew". I am trying to create a script that will automate a file transfer using sftp. Please, I am at rock bottom. Thank you. (2 Replies)
Discussion started by: klindel
2 Replies

8. Shell Programming and Scripting

Need automated shell script please

I'm totally new to shell scripting and I would like to ask your help 1.i want to have a .sh script where it runs opening 2 applications one after another 2.i have 2 applications in /applications/app1 /applications/app2 3. want this script to launch app1 for 20 seconds and get killed... (2 Replies)
Discussion started by: uneex
2 Replies

9. Shell Programming and Scripting

Need help for automated shell script

hi, I have a system with 3 O/S on it ( win 32, RHEL 4 32 & 64) I'm very new to shell scripting and I'm seeking for help in this matter.. I want to have an automated script on REDHAT that would run/open multiple applications one after other timed out at 20 seconds interval. Eg:... (4 Replies)
Discussion started by: uneex
4 Replies

10. UNIX for Advanced & Expert Users

help for automated script

Hi ALL: I need to write a script that will start bunch of servers. and these servers each has a sudo account and they need a passowrd. I dont know where to start and look. Can you please give me some hints or some sample code. Thanks in advance. splax (4 Replies)
Discussion started by: splax
4 Replies
Login or Register to Ask a Question