Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Stop script execution, when we encounter error Post 303032095 by vbe on Monday 11th of March 2019 09:22:25 AM
Old 03-11-2019
From the thread title: "Stop script execution, when we encounter error", reading what you have posted, I am totally lost...
Quote:
Considering scenario i have 1.sql,2.sql,3.sql and 4.sql
OK where do i see them?
Quote:
If my second script fails my loop should come out and should not execute 3.sql and 4.sql.
So what is the script you posted?
Now even this script puzzles me as I cant see how it works...
Do you mind explaining what this first line is supposed to do?
Code:
echo "exit" | user/password | grep Connected > /dev/null

Then
lets say the following works:
Code:
if [ $? -eq 0 ]
then
   echo "Passed"
   while read file

Where is file set? ...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

error during the execution of script

Hi, I have a cron job which executes daily once 9 PM. The script is like if then TYPE=OC elif then TYPE=i elif then TYPE=mmc elif then TYPE=CB elif then TYPE=oth fi (1 Reply)
Discussion started by: surjyap
1 Replies

2. Programming

how to stop execution in for loop

Hi all, I am working on a c source code nearly 2000 line . it contains one big for( i=0; i< 200 ; i++ ) loop of around 600 lines could any tell me how to break the execution of prog when the value of i is 50 in for loop so that i can check inside the loop. Thanks.. (1 Reply)
Discussion started by: useless79
1 Replies

3. AIX

stop execution of script with in the script

Hello i want to incorporate of piece of code in the shell script which checks whether same script is already running or not. If it is already running i want to come out (exit) if its not then continue with the execution of the script. Any help would be very much appreciated Thanks (3 Replies)
Discussion started by: dsdev_123
3 Replies

4. Shell Programming and Scripting

Stop load script if error found...

Hi all, Is there any command in Unix, which will stop the load process if any error is found in the i/p file? I am trying to load 5 files sequentially. A then B then C then D then E end; 1) If A encounter's any error while data load, the load process should stop, and it should not... (5 Replies)
Discussion started by: msrahman
5 Replies

5. Shell Programming and Scripting

how to stop execution of a script after one hour

I have a shell script that writes some data in a file. I want to stop the script after one hour from start of execution using "EXIT 1". how to do it. I don't want to use CRONTAB. (5 Replies)
Discussion started by: mady135
5 Replies

6. Shell Programming and Scripting

Execution error with awk script

Hi, I run an awk script and I got the error attached below: here are the lines that the compiler point to as an error: duration = timeEnd1-timeBegin1; print "Transmission: type of traffic " flow1 ; print “ - Total transmitted bits = ” totalBits1 ” bits”; print “ - duration = ”... (2 Replies)
Discussion started by: ENG_MOHD
2 Replies

7. Shell Programming and Scripting

Stop execution of script if some condition fails

After my if condtion give rusult true then script should stop execution. Please advice...Thnaks in advance (1 Reply)
Discussion started by: vivek1489
1 Replies

8. Shell Programming and Scripting

Syntax error in sh script execution

Script: #!/sbin/sh echo "Welcome to my First Script" echo "Enter a word" read PASS if then echo "You are correct" elif then echo "Thats incorrect" else echo "Bye" fi When i run the script shell says: Syntax error at line 7:'elif' is not expected I ran through some old posts and... (3 Replies)
Discussion started by: Amit Kulkarni
3 Replies

9. Shell Programming and Scripting

To stop execution in cron

hi guys i have a question my cron should start executing minute but it sould stop execute only i have tried tis 10 * * * * /home/sample.sh >> /data/band/cron_$(date+|%Y|m|d).log (2 Replies)
Discussion started by: azherkn3
2 Replies

10. UNIX for Beginners Questions & Answers

How to stop a shell script if it encounters a error?

I am writing a bash shell script for GarazLab's "WP EMAIL CRAWLER - AUTO SCRAPER & REAL TIME EXTRACTOR". it contains some commands. I want to stop the shell execution as soon as it encounters an error. how to do it? (8 Replies)
Discussion started by: tahsin352
8 Replies
CUBRID_PING(3)								 1							    CUBRID_PING(3)

cubrid_ping - Ping a server connection or reconnect if there is no connection

SYNOPSIS
bool cubrid_ping ([resource $conn_identifier]) DESCRIPTION
Checks whether or not the connection to the server is working. PARAMETERS
o $conn_identifier - The CUBRID connection identifier. If the connection identifier is not specified, the last connection opened by cubrid_connect(3) is assumed. RETURN VALUES
Returns TRUE if the connection to the server CUBRID server is working, otherwise FALSE. EXAMPLES
Example #1 cubrid_ping(3) example <?php set_time_limit(0); $conn = cubrid_connect('localhost', 33000, 'demodb'); /* Assuming this query will take a long time */ $sql = "select * from athlete"; $result = cubrid_query($sql); if (!$result) { echo 'Query #1 failed, exiting.'; exit; } /* Make sure the connection is still alive, if not, try to reconnect */ if (!cubrid_ping($conn)) { echo 'Lost connection, exiting after query #1'; exit; } cubrid_free_result($result); /* So the connection is still alive, let's run another query */ $sql2 = "select * from code"; $result2 = cubrid_query($sql2); ?> PHP Documentation Group CUBRID_PING(3)
All times are GMT -4. The time now is 03:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy