Restarting shell script in case of a failure


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Restarting shell script in case of a failure
# 1  
Old 08-22-2019
Restarting shell script in case of a failure

I have a shell script which sqoops data from one place to hive and it does in 2 groups list. If one group is completed it waits for the second to get completed then goto to orc load, but it it fails it kills the other groups and sends a fail email. What I was looking for is if 1 group fails, it should restart that failed group instead of killing the other groups, thereby saving time in rerunning the whole job.

Following is the code:
What i was looking for is, instead of killing the group 2 process it should rerun the shell script(The sh ${HOME_DIR}/Sqoop.SH line) to avoid re-running the whole job. Request you to ask in case the question is unclear.

Last edited by Kunalcurious; 08-23-2019 at 05:12 AM..
# 2  
Old 08-22-2019
just an idea: instead of having a loop monitoring the jobs while they run, add a wait after the background jobs are submitted then add a loop to look for failed jobs in the log files and resubmit only those jobs. Keep looping until all jobs complete normally.

Last edited by rdrtx1; 02-18-2020 at 08:02 PM..
This User Gave Thanks to rdrtx1 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to execute Oracle procedure and trigerring email on success and failure

Here is the shell script which need to trigger a stored procedure and when the record count is 0 then it should capture in the log that 0 duplicate records are found and if it's more than 0 then log with no of records. Also if there is any sqlerror then it should write the same in the log file and... (17 Replies)
Discussion started by: senmng
17 Replies

2. Shell Programming and Scripting

Help with shell script 'CASE $'

Hi, I have a script that is called by /etc/init.d/S99oracle and the contents of this script are below. $ cat ../init.d/oracle ### BEGIN INIT INFO # Provides: oracle # Required-Start: $ALL # Required-Stop: # Default-Start: 3 5 # chkconfig: 35 99 10 # Default-Stop: # Description:... (7 Replies)
Discussion started by: welldone
7 Replies

3. Shell Programming and Scripting

[Solved] Change Upper case to Lower case in C shell

Is there a command that can switch a character variable from UPPER case to lower case? like foreach AC ( ABC BCD PLL QIO) set ac `COMMAND($AC)` ... end Thanks a lot! (3 Replies)
Discussion started by: rockytodd
3 Replies

4. Shell Programming and Scripting

Combination of case and If else in shell script

Would it be right forme to combine case statement and if else in one shell script? Would it work? (2 Replies)
Discussion started by: Pauline mugisha
2 Replies

5. Shell Programming and Scripting

getopts case statement failure

Hi, I have a getopts that works fine if I provide an option but I want it to exit if nothing is given, but for some reason it drops out and continues with the script. Any ideas? while getopts d:m:y: o do case $o in d) day=$OPTARG ;; ... (1 Reply)
Discussion started by: nhatch
1 Replies

6. UNIX for Dummies Questions & Answers

How to list the Autosys jobs thats in failure status using Shell Script

Hello There, I am pretty much new to Shell Scripting and also to AutoSys. I would like to know how to list the Autosys jobs in FA status using shell scripting. I would like to get an email alert as and when any Autosys job fails. Also, it should give the path of the Log file. Could you please... (5 Replies)
Discussion started by: supragna
5 Replies

7. Shell Programming and Scripting

shell script case statement

In a case statement like below : case $rental in "car") echo "For $rental Rs.20 per k/m";; "van") echo "For $rental Rs.10 per k/m";; "jeep") echo "For $rental Rs.5 per k/m";; "bicycle") echo "For $rental 20 paisa per k/m";; *) echo "Sorry, I can not gat a $rental for you";;... (4 Replies)
Discussion started by: sriram003
4 Replies

8. Shell Programming and Scripting

How to list the Autosys jobs thats in failure status using Shell Script

hello There, I am pretty much new to Shell Scripting and also to AutoSys. I would like to know how to list the Autosys jobs in FA status using shell scripting. I would like to get an email alert as and when any Autosys job fails. Also, it should give the path of the Log file. Could you please... (0 Replies)
Discussion started by: supragna
0 Replies

9. UNIX for Advanced & Expert Users

Shell script to convert to Title case

I need a shell script which will convert the given string to Title case. E.g "hi man" to "Hi man" (5 Replies)
Discussion started by: SankarV
5 Replies

10. UNIX for Dummies Questions & Answers

lower case to upper case string conversion in shell script

How can convert a Lower case variable value to an upper case in the kron shell script. (3 Replies)
Discussion started by: dchalavadi
3 Replies
Login or Register to Ask a Question