Sponsored Content
Top Forums UNIX for Advanced & Expert Users rerun a script if aborted and exited Post 302169377 by bakunin on Thursday 21st of February 2008 05:09:33 AM
Old 02-21-2008
If your script sets exit codes (as, in an ideal world, should any process) it is not too hard to use a script wrapper:

First your_script.sh skeleton:
Code:
#! /bin/ksh

.... your code ....

if [ ... some condition ...] ; then
     print - u2 "Houston, we have a problem. Aborting...."
     exit 1      # aborted for some reason
fi

... more of your code ....

exit 0      # normal exit

Now the wrapper.sh skeleton:

Code:
#! /bin/ksh

while : ; do
     your_script.sh         # call your_script.sh
     if [ $? -eq 0 ] ; then
          break         # exit the loop if your_script.sh finished normally
     fi
done

exit 0

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. AIX

rerun .profile after changing variable

I changed a $variable in my .profile (AIX unix). I know I could exit out and logon onto unix again, but how do I rerun the .profile at the command line? (2 Replies)
Discussion started by: sboxtops
2 Replies

2. Programming

Program exited with code 01: does it indicate unsuccessful compilation?

(gdb) r --------------------- enter Breakpoint 1, 0x0000000000409d40 in main () (gdb) n Single stepping until exit from function main, which has no line number information. Find_Cmd_Option: found option no. 2: seed (s) Find_Cmd_Option: found option no. 5: dfile (c) Initial no. div... (1 Reply)
Discussion started by: cdbug
1 Replies

3. Shell Programming and Scripting

Rerun sql statement

Hi, Script that I wrote only run sql query once then exit. But my requirement, I want the query can be execute a couple of time without exiting the script. How could I do it? Thanks. (1 Reply)
Discussion started by: killboy
1 Replies

4. Shell Programming and Scripting

Automatically Rerun a script based on previous execution output

Hi Experts, I have a shell script called "updatevs" that is scheduled to run at 6.00 am everyday via cronjob. The cronjob will execute this script and output to a log file. The functionality of this script is to read the database and run a set of commands. This script is generally successful... (6 Replies)
Discussion started by: forumthreads
6 Replies

5. Shell Programming and Scripting

Rerun a cronjob if it doesn't work at first.

I want to add a line to the script that searches for a file. If the file does not exist, I need to kill the cronjob and run it again in one hour. I am running the program and 2 am and 2pm. I would want the job to run again at 3am and 3pm respectively. How could I do this and still keep the cronjob... (1 Reply)
Discussion started by: libertyforall
1 Replies

6. UNIX for Dummies Questions & Answers

WARNING: init(1M) exited on fatal signal 9: restarting automatically

Have you ever got these : WARNING: init(1M) exited on fatal signal 9: restarting automatically and how did you solve it? (3 Replies)
Discussion started by: anaABB
3 Replies

7. Solaris

backup aborted

hi all I am getting following error while taking backup using the command ufsdump 0ubf 512 /dev/rmt/0cbn /database/backup2/rman_backup/level0 >> /database/backup2/backup_tape/level0_rman_06sep12 2>&1; from the log i got the error bash# tail -f level0_rman_06sep12 DUMP: Date of... (3 Replies)
Discussion started by: nikhil kasar
3 Replies

8. UNIX for Dummies Questions & Answers

Remotely close & rerun SSH connection

I'm trying to remotely run an upgrade script (via SSH) that update the SSH script on several hosts, just need to add several flags for the ssh command to look like this: ssh -Nf -i id_logs -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=5... (4 Replies)
Discussion started by: OdedOvdat
4 Replies

9. Red Hat

RHEL6 : Remote process exited without returning status

Hi All, I am using RHEL 6 linux in my lab server and I am new to RHEL6 features. lab1:root> uname -a Linux lab1 2.6.32-358.18.1.el6.x86_64 #1 SMP Fri Aug 2 17:04:38 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux I am facing a peculiar issue in my lab machine. When I connected via Opsware Global... (0 Replies)
Discussion started by: go2suresh1979
0 Replies

10. Solaris

./deinstall: Exited from program error

I am wondering if I can get some help here. I am deinstalling Oracle home on solaris. Downloaded deintsall zip file from oracle and then ran ./deinstall -home (Full Path) 10 seconds later I get this: Any idea how to resolve this issue? $ ./deinstall -home... (4 Replies)
Discussion started by: newborndba
4 Replies
make_combined_log.pl(1) 				      General Commands Manual					   make_combined_log.pl(1)

NAME
make_combined_log.pl - make combined logfile from SQL database SYNOPSIS
make_combined_log.pl <days> <virtual host> DESCRIPTION
This perl script extracts the httpd access data from a MySQL database and formats it properly for parsing by 3rd-party log analysis tools. The script is intended to be run out by cron. Its commandline arguments tell it how many days' worth of access records to extract, and which virtual_host you are interested in (because many people log several virthosts to one MySQL db.) This permits you to run it daily, weekly, every 9 days -- whatever you decide. NOTE
By "days" I mean "chunks of 24 hours prior to the moment this script is run." So if you run it at 4:34 p.m. on the 12th, it will go back through 4:34 p.m. on the 11th. KNOWN ISSUES
Because GET and POST are not discriminated in the MySQL log, we'll just assume that all requests are GETs. This should have negligible effect on any analysis software. This could be remedied IF you stored the full HTTP request in your database instead of just the URI, but that's going to cost you a LOT of space really quickly... Because this is somewhat of a quick hack it doesn't do the most robust error checking in the world. Run it by hand to confirm your usage before putting it in crontab. AUTHOR
Edward Rudd <eddie@omegaware.com> MAN PAGE CREATED BY
Michael A. Toth <lirul.lists@gmail.com> - based on comments of script COMMENTS
This man page was written using xml2man (1) by the same author. Manuals User make_combined_log.pl(1)
All times are GMT -4. The time now is 10:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy