Need info on looping

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Need info on looping
# 8  
Old 04-05-2017
Hi @drysdalk , its -bash

Last edited by JSKOBS; 04-05-2017 at 05:22 AM..
# 9  
Old 04-05-2017
Hi,

OK, great. That's fine then, the supplied code should definitely work. So if you can answer the other questions (about how you're attempting to identify the abnormal termination of the script, and why you believe you can't detect this) we can take things from there.
# 10  
Old 04-05-2017
im calling the script from control-m scheduler
abnormal termination of the script will be detected with exit 1 or 2 or 5. Successful is exit 0
with the provided changes, it is mailing till End_of_day.log present but job didn't abend.
# 11  
Old 04-05-2017
Hi,

Hmm, I'm sorry, I don't know what else to suggest at this point. You could maybe try adding some debugging code to capture the output if you can do that, to see when the abend variable is being set, and what exit command your script is attempting to do.

But if you have made the changes I suggested (or some variation thereof), there can't be any way that the script will fail to do abend=1 after sending the mail (unless the very act of sending the mail causes some kind of uncontrollable crash, I suppose, but that's unlikely to say the least), and likewise there can't be any way it will fail to do an exit 1 if abend is set at exit time.
# 12  
Old 04-05-2017
If I only knew how you use the verb "abend" - my dictionary tells me "system / program crash" or "abnormal termination".

Why not a function? try

Code:
proc2eod ()     { XTCD=1
                  until [ -e End_of_day.log ]
                    do  [ -s file.txt ] && XTCD=0 && echo mail your stuff
                        sleep 3
                    done
                  return $XTCD
                }

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Looping problem

I need help. I am trying to get this script to send out only one email not multiple emails of the abend. Currently it will send me one then and ther with the first and second one then another email with the first second and third abend and so on. I only want one email sent. ... (2 Replies)
Discussion started by: bbcarosi
2 Replies

2. Shell Programming and Scripting

Looping

Hey guys, so I am trying to do a loop script that will go through each folder (no gui so just each domain has a folder) and grab out the databases being used on that domain. I know I would use mysql -e "show databases where not 'information_schema';" once in each directory to pull the actual... (3 Replies)
Discussion started by: dough
3 Replies

3. Shell Programming and Scripting

Looping advice

Hello guys i am generating files in while loop and i want add value in every file start from 10 to 55 and repeat that so the value never exceed 55 and always start from 10 can you advice how this can be done in while loop? (4 Replies)
Discussion started by: mogabr
4 Replies

4. Shell Programming and Scripting

Looping

Hi evryone i need a help . i have a file xcv.the content is : accelerate i want a script which will run 1000 times in loop and changing the value to accelerate to acceler in 1st loop and in 2nd loop it will be again accelerate and so on . (6 Replies)
Discussion started by: Aditya.Gurgaon
6 Replies

5. Shell Programming and Scripting

Looping

Hi, Now I have written a script which sorts the records in the file and splits them according to some condition. Now, I need to modify the script so that it reads all the files one after the other and does the sorting & splitting. Pls help me in reading all the files in a directory and... (8 Replies)
Discussion started by: Sunitha_edi82
8 Replies

6. Shell Programming and Scripting

help with looping

vesselNames values: xxx yyy zzz vesselPlanned values: xxx zzz zzz zzz OIFS="" OIFS=$IFS IFS="\n" (2 Replies)
Discussion started by: finalight
2 Replies

7. Shell Programming and Scripting

help on looping using if/for or while

Hello, where can I get usefull information on the use of looping with for , if and while with extensive examples. Also use of variables in scripts (1 Reply)
Discussion started by: sam4now
1 Replies

8. Shell Programming and Scripting

for looping

I run into a issue when I try to do sorting of the following with ascending order, one round of for looping seems not working, anyone knows how to use shell or perl? $array = (5,0,3,2,7,9,8) (2 Replies)
Discussion started by: ccp
2 Replies

9. Shell Programming and Scripting

looping

Hi I have around 100 users in sun server and have default home directory in /usr/home/<username> I want to clean their home directory time to time to make free space on root, as users generate many output files during usage of application. My idea is, generate a file with following command... (4 Replies)
Discussion started by: ishir
4 Replies

10. UNIX for Dummies Questions & Answers

Help with looping

Hi, Actually I have a file which consists data . for eg names. Then I want my sql query to read this file and produce the output. Currently I am using this FOR EG : FILENAME is NAMES for i in `cat NAMES` { sqlplus -s $CONNECTID << EOF spool rooh set heading off select... (1 Reply)
Discussion started by: rooh
1 Replies
Login or Register to Ask a Question