performing cleanup when a job finishes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting performing cleanup when a job finishes
# 1  
Old 03-04-2008
performing cleanup when a job finishes

The title sounds like an easy problem (maybe it is), however, the catch is that when a job 'A' is called inside a wrapper, the execution does not wait for 'A' to finish, but it goes on to the next line (right after kicking off 'A').

My question is, how will you keep the execution waiting for that job to complete, so that I can perform some cleanup and/or archiving of files after 'A' completes.

*Note: Something that might help.... When 'A' is kicked off, it begins writing some lines of data to a file called success.txt. When 'A' completes, it stops writing to success.txt.

Thanks,

CB
# 2  
Old 03-05-2008
Quote:
Originally Posted by ChicagoBlues
The title sounds like an easy problem (maybe it is), however, the catch is that when a job 'A' is called inside a wrapper, the execution does not wait for 'A' to finish, but it goes on to the next line (right after kicking off 'A').

My question is, how will you keep the execution waiting for that job to complete, so that I can perform some cleanup and/or archiving of files after 'A' completes.

*Note: Something that might help.... When 'A' is kicked off, it begins writing some lines of data to a file called success.txt. When 'A' completes, it stops writing to success.txt.

Thanks,

CB
Not sure if this helps, but did you try executing task A using 'eval' command ?
# 3  
Old 03-06-2008
Not sure if you already had a solution for this. I guess sleep command would help.After the execution command of job A , the next statement can be a sleep statement.Let job A finish completely and then you can go the next line.

No idea if you have time contraints , but if you don;t this could be tried.
# 4  
Old 03-06-2008
sleep will put the current thread to sleep for ## seconds. However, each time the process runtime varies, so I cannot hard-code the number of seconds.
# 5  
Old 03-06-2008
Quote:
Originally Posted by ChicagoBlues
The title sounds like an easy problem (maybe it is), however, the catch is that when a job 'A' is called inside a wrapper, the execution does not wait for 'A' to finish, but it goes on to the next line (right after kicking off 'A').

My question is, how will you keep the execution waiting for that job to complete, so that I can perform some cleanup and/or archiving of files after 'A' completes.

*Note: Something that might help.... When 'A' is kicked off, it begins writing some lines of data to a file called success.txt. When 'A' completes, it stops writing to success.txt.

Thanks,

CB
Is job A called in the background? Post the line of code that kicks off job A.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Wait till any one child process finishes

Hi I am facing a problem in my ksh. My main script is calling 3 different child process in the background. I am using wait to finish all and then submit another 3 child processes. Now what i want is , whenever any one child process finishes ,i want to submit next one.so that parallel 3... (2 Replies)
Discussion started by: Sangu
2 Replies

2. Shell Programming and Scripting

Expect script executes .pl before mount finishes

Hi, I'm trying to mount machines that are 'ON' with an expect script. I would put these guys in fstab, but the virtual machine that runs script seems to freeze up/shutdown if one of the machines I'm trying to connect to is 'OFF'. Following the mount, I run a perl script that accesses the 'ON'... (1 Reply)
Discussion started by: jdilts
1 Replies

3. Programming

Performing a while for two files

Hi, This is for Perl. I have a while loop, and would like to process two files, the formats are given below : access access.<previousday>-* How can perform a while loop on both logs, while creating the logic for access.<previousday>-* to get format like "access.20130615-124139" when... (11 Replies)
Discussion started by: susankoperna1
11 Replies

4. UNIX for Advanced & Expert Users

slow performing system

Friends Greetings. I have a RedHat 5.7 64bit virtual server on VMware ESXi 4.1. This server and other Redhat Servers are running very slow. I did some stats collection on ESXi and looks like Linux is holding the disk IO. I am not sure what is causing this behavior. On Linux I checked the CPU... (4 Replies)
Discussion started by: sdewal
4 Replies

5. Shell Programming and Scripting

Performing lookup quickly

Hello, Have been trying to develop a script that reads a string from an input file then looks up that string in a reference file to get a number, then inset that number back into the original file at a certain point (_____): Input File: HARRY JON _____ AA M N PETER PIE ... (8 Replies)
Discussion started by: dendright
8 Replies

6. Shell Programming and Scripting

Check if wget finishes

how can you check if wget finishes? i have this code to store the source of a website url into a variable: source=$(wget --timeout=15 -qO - $site) but this gets stuck sometimes e.g., one site had a virus and it stopped the script how can i check if wget finishes? i tried to run... (5 Replies)
Discussion started by: vanessafan99
5 Replies

7. Shell Programming and Scripting

Deleting string within a file that finishes with .log

Hello, This is my first post. Nice forum! I have a file trls.results small exemple of content (actually the file can be very big): ./security/htaccess.htm ./security/ipcount.log ./adhoc/sql/datamod06.sql So there is 3 paths to 3 different files... I want to remove every string that has a... (9 Replies)
Discussion started by: Jacob106106
9 Replies

8. UNIX for Dummies Questions & Answers

Prints to screen when background process finishes

If I run "sleep 10&".. when that background process is done, is there a way for unix to print to screen to let me know? Thanks. (1 Reply)
Discussion started by: jmelai
1 Replies

9. UNIX for Dummies Questions & Answers

Cleanup job to remove old files suddenly not working

Hi I have a job that has been running for a while with the following statement to cleanup a directory: find /dbmgtu01/app/myplace/log ! \( -name "dc*" -o -name "sc*" -o -name "ms*" \) -type f -mtime +30 -print -exec rm {} \ ; The directory was recently changed to a mount point, with a symbolic... (2 Replies)
Discussion started by: CAGIRL
2 Replies

10. Shell Programming and Scripting

send mail after script finishes running

Hi All, We now have a Log file which has time stamps of all the scripts ran. It has start time and end time. I now have a requirement to send mail to the Admin after the script finishes running. Can some one help me with a Script which will send mail with Start time and End time of the... (2 Replies)
Discussion started by: srikanthgr1
2 Replies
Login or Register to Ask a Question