Sponsored Content
Top Forums Shell Programming and Scripting Rerunning a command in a script that failed? Post 302215632 by Ikon on Wednesday 16th of July 2008 10:31:28 PM
Old 07-16-2008
You COULD:

until [ $status == 0 ]
do
somecommand someargs
status=$?
done

echo "Exited with status:$status"



but it would loop indefinitely if the command always failed. Would probabally want to put some limit to the number of times to retry.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Failed to get value from a file using sed command

Hi folks, I have the following file (tnsnames.ora): DB10g = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = buffy)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DB10g) ) ) EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = ... (2 Replies)
Discussion started by: nir_s
2 Replies

2. UNIX for Dummies Questions & Answers

Problem with Mail command: exec failed. errno=2.

I am trying to send email using the "mail" command. I keep getting an "exec failed. errno=2." message. Here is one the commands I have tried: mail test@mycompany.com < test1.out Any ideas what may be causing this error msg? (1 Reply)
Discussion started by: hawkman2k
1 Replies

3. UNIX for Advanced & Expert Users

rm & mv command failed due to too many files.

In our directory there are too many files, & if I try to execute mv *.gz or rm *.l command it fails, providing error string as - 'arg list too long'. This doesnt happen always, is there any way we know, limit on the rm & mv command so we can take care of this failure in future executions ? (9 Replies)
Discussion started by: videsh77
9 Replies

4. UNIX for Dummies Questions & Answers

make command failed for target 'obj/gp_unix.o'

hi, i am trying to run make command in solaris 9. its giving the error: make:Fatal error:Command failed for target 'obj/gp_unix.o' i came to know X11 should be inastalled for gp_unix.o.But it is already installed.still the same error. ./configure worked fine. can anybody please suggest... (3 Replies)
Discussion started by: rosalina
3 Replies

5. Shell Programming and Scripting

Script exits with $? not 0 randomly, how can I see what command failed?

Hi! I have this situation with 3 shellscripts. One is a "startscript" that simply calls other scripts. This one is scheduled with cron to run at regular intervals. That script runs what I'll refer to as Script 1. Script 1 in turn runs script 2 (import_catalogs_buyer.sh) Sometimes, seemingly... (2 Replies)
Discussion started by: trailsmoke
2 Replies

6. Solaris

command 'cc' failed even though gcc is installed

I'm trying to build some python modules on a Solaris 10 machine. It has gcc as /usr/sfw/bin/gcc. # CC=gcc python setup.py build running build running build_py running build_ext cc -c actread.c -o actread.o unable to execute cc: No such file or directory error: command 'cc' failed with exit... (8 Replies)
Discussion started by: aussieos
8 Replies

7. Solaris

Command to find the failed disks in SVM and VxVM

How to find & replace bad disks in solaris & VXVM?plz explain step by step? (2 Replies)
Discussion started by: xtreams
2 Replies

8. Solaris

Script redirect command output failed, why?

Hi, I put a for loop in a script to eject backup tapes from the robot. The command echo' output goes to the log file without problem, but command vmchange's output does not go to the log file although it's working fine. It still displays on the screen. I've tried '2>&1 1>$log', but nothing changed.... (5 Replies)
Discussion started by: aixlover
5 Replies

9. Shell Programming and Scripting

How to find whether a particular command has failed inside an sftp script?

hi, how can i know whether a command inside an sftp script has failed or not? i have a sftp expect script #!/usr/bin/expect spawn /usr/bin/sftp abc@ftp.abc.com expect "sftp>" send "cd dir\r" expect "sftp>" send "mput abc.txt\r" expect "sftp>" send "mput def.xls\r" expect "sftp>"... (5 Replies)
Discussion started by: Little
5 Replies

10. UNIX for Advanced & Expert Users

Resume from last failed command

Dear Experts, I am creating a shell script (A) which is menu driven and in turn calls another shell scripts (X) depending on the selection. X has a list of commands which runs batch jobs in auto mode. Content of X ./sqr.ksh axhri051_sf axhri051_sf.par $1 $2 XHRPPYOV; ./sqr.ksh axbni062... (19 Replies)
Discussion started by: rprasad
19 Replies
pthread_exc_get_status_np(3)				     Library Functions Manual				      pthread_exc_get_status_np(3)

NAME
pthread_exc_get_status_np - (Macro) Obtains a system-defined error status from a DECthreads status exception object. LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so) SYNOPSIS
#include <pthread_exception.h> int pthread_exc_get_status_np( EXCEPTION *exception, unsigned long *code); STANDARDS
None PARAMETERS
DECthreads status exception object whose status code is obtained. Receives the system-specific status code associated with the specified DECthreads status exception object. DESCRIPTION
This routine obtains and returns the system-specific status value from the DECthreads status exception object specified in the exception argument. This value must have already been associated with the exception object using the pthread_exc_set_status_np(3) routine. In a program that uses DECthreads status exceptions, use this routine within a CATCH, CATCH_ALL, or FINALLY code block to obtain the status code value associated with a caught exception. Note that any exception objects set to the same status value are considered equivalent by DECthreads. RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. If the routine's exception object argu- ment is a DECthreads status exception, it sets the code argument and return zero (0). Possible return values are as follows: Successful completion. The exception argument is not a valid DECthreads status exception object. ERRORS
None RELATED INFORMATION
Functions: pthread_exc_set_status_np(3) Manuals: Guide to DECthreads and Programmer's Guide delim off pthread_exc_get_status_np(3)
All times are GMT -4. The time now is 09:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy