Script to execute multiple scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to execute multiple scripts
# 1  
Old 10-06-2011
Script to execute multiple scripts

Hi All,

I have 4 scripts to execute. Each one take anywhere from 3 -9 hours to run depending on what it's doing. I'm running one at a time then check back periodically to see if it's still going and if not, run the other.

How can I put these scripts into another script so that they are executed without me having to check in on them. Something like:

run script1.sh
email me - script1 is running
check to see if it's running, if so sleep 10
if not run script2.sh
email me - script2 is running ..... and so forth, until all the scripts are done.

Thanks in advance.
# 2  
Old 10-06-2011
Code:
./script1 && ./script2 && ./script3 && ./scrpit4

if e-mail-ing is required on completion, then need to tweak the code!

Code:
./script1
wait 
echo "script1 comepleted" | mail you@you.com

./script2
wait 
echo "script2 comepleted" | mail you@you.com


./script3
wait 
echo "script3 comepleted" | mail you@you.com


./script4
wait 
echo "script4 comepleted" | mail you@you.com

--ahamed
# 3  
Old 10-06-2011
Really? That simple. So I can create a file and place that command in and then;

nohup ./file-containing-scripts &

?
# 4  
Old 10-06-2011
exactly. all depends on how in depth you want your wrapper script to be. does it need to check return codes from your 4 scripts and include in the email, or are you just doing very basic script execution and reporting?
# 5  
Old 10-06-2011
Quote:
Originally Posted by unxscorob
exactly. all depends on how in depth you want your wrapper script to be. does it need to check return codes from your 4 scripts and include in the email, or are you just doing very basic script execution and reporting?
Just basic. I'd be interested in knowing how to have it check the return code and place that in the email tho'.
# 6  
Old 10-06-2011
Code:
./1
ret1=$?
wait
echo "Script1 returned $ret1" | mail you@you.com

--ahamed

---------- Post updated at 07:01 PM ---------- Previous update was at 07:00 PM ----------

On a second thought, I don't think we need the "wait" at all.

--ahamed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute Multiple Scripts and Capture Log Details

Hi All, I have a requirement to execute multiple scripts (say 4) one after the other in one script and capture log details and error messages in a log file below LOG_FILE= FILE.`date ++"%Y%m%d%H:%M:%S"` Script 1 : File_Checkr.sh Script 2 : Pre_Validation.sh Script 3 : Testing.sh Script... (12 Replies)
Discussion started by: Deena1984
12 Replies

2. Shell Programming and Scripting

Script which takes two inputs based on that execute othe scripts

Hi, I am using solaris 10 bash shell.this might a small script but i am not much familiar with scripting. My requirement here is script should prompt for users two opions like this "please select either any one option makefile or make& build file". if the user selects make file option... (2 Replies)
Discussion started by: muraliinfy04
2 Replies

3. Shell Programming and Scripting

Find and execute shell scripts in multiple sub directories in parallel

I have one parent directory and within that parent directory there are several other sub-directories and within those sub-directories there are several other "large number" of sub-directories. All the sub directories have a shell script in them with a common file name execute_command.sh I want... (4 Replies)
Discussion started by: shoaibjameel123
4 Replies

4. UNIX and Linux Applications

how to execute multiple .sql scripts from within a shell script using sqlplus

using sqlplus I want to execute a .sql script that has dbms_output statments in rhe script. I want to write the dbms_output statements from .sql file to a log file. is this possible. thanks any help would be appreciated :wall: (1 Reply)
Discussion started by: TRS80
1 Replies

5. Shell Programming and Scripting

Need to execute different scripts with shell script

Hi All, Am in need of some inputs to overcome the following problem, A tar file(/var/execute/scripts/ that contains different types of scripts(may be perl,shell, python etc...). I have written a shell script which is located @ /var/execute.sh to untar the file in some location say... (1 Reply)
Discussion started by: SMNK
1 Replies

6. Shell Programming and Scripting

Execute multiple SQL scripts from single SQL Plus connection

Hi! I would like to do a single connection to sqlplus and execute some querys. Actually I do for every query one connection to database i.e echo 'select STATUS from v$instance; exit' > $SQL_FILE sqlplus user/pass@sid @$SQL_FILE > $SELECT_RESULT echo 'select VERSION from v$instance;... (6 Replies)
Discussion started by: guif
6 Replies

7. Shell Programming and Scripting

Not able to execute many SQL scripts within a shell script

I am using HP-UX: I have written a ksh script where I need to connect to sqlplus and execute few sql scripts. Part of this code is - sqlplus user/temp1234 <<! set serverout on set feedback off set pages 1000 set colsep , set echo off spool /home/supp1/pks/output.csv... (8 Replies)
Discussion started by: Sriranga
8 Replies

8. Shell Programming and Scripting

Script to connect to a remote server and execute scripts

Hello All I need a script or set of commands which can establish a remote connection with another server and execute some scripts over there. Basically it has to establish the connection with the remote server as an user ,say 'testuser' and then execute the script 'testscript'. and return the... (5 Replies)
Discussion started by: sgbhat
5 Replies

9. Shell Programming and Scripting

How to execute the multiple line sql using shell script

Hi All, Please help me to write a shell script to execute the below sql query. select c.account_no,b.bill_no,a.pay_type,(b.total_due + b.recvd + b.adjusted + b.disputed + b.transferred) as amt_not_billed,d.cash_on_delivery, (select j.bill_no from billinfo_T y, bill_t j where... (1 Reply)
Discussion started by: girish.raos
1 Replies

10. Shell Programming and Scripting

how do i get my script to execute multiple commands?

New to shell scripting. I can't get my script to execute multiple commands. Here's the code. It's a menu script. #!/bin/ksh clear print "SDE MENU" PS3="SDE MENU, enter choice:" select clean_menu in "tasdedev instance 5151" "orkindev instance 5155" "tasdetst instance 5157" "orkinsys... (1 Reply)
Discussion started by: hvincent
1 Replies
Login or Register to Ask a Question