Sponsored Content
Top Forums Shell Programming and Scripting Abort the execution if one script have errors Post 302937382 by jiam912 on Thursday 5th of March 2015 10:03:11 AM
Old 03-05-2015
Abort the execution if one script have errors

Gents,

I have a script which will run others scripts .

Example

Code:
#!/bin/bash

script1
script2
script3
script4

I would like to stop all process if any of the script got errors?. If for example script1 works fine will continue script2, then if the script2 got errors, The bash should stop and will no continue to script3.

Is there any solution for this.

Thanks for your help.
 

9 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Abort core dumped!!!!

HI All, I am working on Solaris 8, i have this application runing on one of the partitions,(the installation was done here ie /export/home) And the out put of this goes to another parition of other disk attached to the same machine. After a certain period of time is get this error stating... (2 Replies)
Discussion started by: zing
2 Replies

2. Shell Programming and Scripting

How to make bash script abort?

I have a little bash script that includes make to compile with g++ and then a statement to actually run the compiled program. When it (the script) gets a syntax error, it does not abort and continues to run the previous version of the program. How can I make the script abort when g++ generates a... (1 Reply)
Discussion started by: siegfried
1 Replies

3. Shell Programming and Scripting

How to handle errors during script execution

Hi I have written a script which returns a number. This resulting number I assign to the variable for example: $ A=`get_dbnum 118 ttrn` $ echo ${A} 8208 $ The script becomes interective once the error occures and the number is not found. It prompts the user to enter the number. The... (1 Reply)
Discussion started by: aoussenko
1 Replies

4. Shell Programming and Scripting

Help with execution errors in script

solution found.... Please use tags for scripts, listings, and console output (2 Replies)
Discussion started by: audiolord
2 Replies

5. Solaris

Abort the shell script if any hive sql query gets failed

Below is my shell script from which I am trying to invoke few Hive SQL queries and the below shell script works fine. Problem Statement:- If you see my first `hive -e` block in the below shell script which contains a very long Hive SQL query. Sometimes that Hive SQL query gets failed due to... (1 Reply)
Discussion started by: raihan26
1 Replies

6. Shell Programming and Scripting

Shell Script to Abort if file name has space.

Hi, In my shell script I use the following code to copy files from one directory to other. for file in `ls`; do #----------------- Copy Files From INDIR to OUTDIR -------------# echoen "Copying File ${INDIR}/$file to ${OUTDIR}/${file}" cp ${INDIR}/$file ... (4 Replies)
Discussion started by: pinnacle
4 Replies

7. Shell Programming and Scripting

How to Abort or Come out of ksh script?

Hi All, I have a requirement where if Source Count is not equal to Target count, then I need to exit/abort the script and come out. Then send an email to thummi@email.com saying "RECORD COUNT DOES NOT MATCH. Please need your help. Here is what I have written : If even the count is not... (1 Reply)
Discussion started by: thummi9090
1 Replies

8. Shell Programming and Scripting

Awk. Abort script if condition was met.

I want to abort script if input variable matched first field in any line of a file. #!/bin/sh read INPUTVAR1 awk "{if(\$INPUTVAR1 == $1) x = 1} END {if(x==1) print \"I want to abort script here\"; else print \"OK\"}" /etc/some.conf I tried "exit" and system("exit") but no luck. (1 Reply)
Discussion started by: urello
1 Replies

9. Shell Programming and Scripting

If Telnet fail abort other command..??

Hi Team, I my script i telent my node ip and after loging i run some commands...But some time login fail so i want to stop script at that time.. CONFIG_CHNG.sh printf 'Please Input Node ID : ' read node node="$node" #exec > node_log_$node.log 2>&1 #set -x >... (2 Replies)
Discussion started by: Ganesh Mankar
2 Replies
itruns(8)						      System Manager's Manual							 itruns(8)

NAME
itruns - set up files for use by the it command SYNOPSIS
/sbin/itruns file [file...] in run-state [, file [file...] in run-state] [,...] DESCRIPTION
The itruns program sets up scripts to be run by it(8). (These programs are typically used within system configuration and installation scripts.) The itruns command searches for /sbin/it.d/bin/file. If itruns finds the file, it creates one or more symbolic links from /sbin/it.d/run-state.d/file to /sbin/it.d/bin/file. The run-state argument can be a single run state, or it can be two run states separated by either the word or or the word and. If two run states are specified with the or keyword, itruns checks for (and creates, if necessary) a directory whose name combines both run states and places a link in that directory so that the file will be executed when the it program detects either state. You can collapse two or-sepa- rated states into a single expression; for example, 2 or 3 can be expressed as 23. If the and keyword is used, itruns checks for (and cre- ates, if necessary) two separate directories and places a link in each of them so that either state triggers execution of the file indepen- dently of the other state. If two or more files are specified for a single run-state argument, links are created for all of the files as indicated by the run-state argument. If two or more combinations of files and run states are specified as comma-separated expressions, itruns treats each combination individu- ally. RESTRICTIONS
The itruns command must be executed from the root directory (/). The command finds only files that are located in the /sbin/it.d/bin direc- tory. EXAMPLES
This example sets up the doconfig script to be run when the system is booted to run state 2: itruns doconfig in 2 Either of the command lines in this example sets up the doconfig and getdate scripts to be run when the system is booted to run state 2 or to run state 3: itruns doconfig getdate in 2 or 3 itruns doconfig getdate in 23 This example sets up the doconfig script to be run when the system is booted to run state 2 and again when the system comes to run state 3, the getdate script to be run only in run state 2, and the getsysname script to be run only in run state 3: itruns doconfig in 2 and 3, getdate in 2, getsysname in 3 SEE ALSO
Commands: it(8) itruns(8)
All times are GMT -4. The time now is 03:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy