Waiting for a process to complete in shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Waiting for a process to complete in shell script
# 1  
Old 05-28-2013
Tools Waiting for a process to complete in shell script

Hi,
I need to initiate a process script which will start and do some processing and then shuts down. Then i need to other verifications. But the the process takes around 25 to 3o minutes.
One thing i can monitor the nohup.out file for this process where i can wait for shutting down statement to appear.
I s there any other way i can code it ina better way

All the help is appreciated.

Thanks,
Prashanth
# 2  
Old 05-28-2013
Did you consider using wait?
# 3  
Old 05-28-2013
yes i considered the wait , but since duration is more here, so is it worth using this here ?
# 4  
Old 05-28-2013
Quote:
Originally Posted by Prashanth19
yes i considered the wait , but since duration is more here, so is it worth using this here ?
If you just started the process asynchronously, you could wait for it. In this case, however, it looks like you started it using nohup. Most implementations of nohup that I've seen spawn a process to run the specified utility, report if the child was not successfully started, and then exit. This means that the child process created is an orphan that can't be waited for by the shell that called nohup.

If you're sitting at a terminal doing other things while waiting for the child to complete, one frequent way to manually track the process of a nohup'ed process is to use:
Code:
tail -f nohup.out&

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Subprocess.popen() should write to log without waiting for process to complete

Here is my test code process = sp.Popen( + , bufsize=1, universal_newlines=True, stdout=sp.PIPE, stderr=sp.STDOUT, cwd=src_home) output, _ =... (2 Replies)
Discussion started by: ezee
2 Replies

2. Shell Programming and Scripting

How to break out of hung or waiting telnet session in shell script?

I have to put together telnet instructions for 100s of hosts for verifying basic connectivity and get output in a neat format. Problem- If a telnet is hung with message "Trying .... <hostname" due to firewall or routing issue the commands waits for a very long time before it times out and my... (2 Replies)
Discussion started by: desiphantom
2 Replies

3. Shell Programming and Scripting

Script that waits for process to complete

Hello, I am in need of running an executable provided by a vendor that basically syncs files to a db. This tool can only be run against one folder at a time and it cannot have more than one instance running at a time. However, I need to run this tool against multiple folders. Each run of the... (5 Replies)
Discussion started by: vipertech
5 Replies

4. Shell Programming and Scripting

Wait for one processes to complete in a shell script

Let's say I start process A.sh, then start process B.sh. I call both of them in my C.sh How can I make sure that B starts its execution only after A.sh finishes. I have to do this in loop.Execution time of A.sh may vary everytime. It is a parameterized script. (17 Replies)
Discussion started by: rafa_fed2
17 Replies

5. Windows & DOS: Issues & Discussions

AutoSys Job not waiting for script to complete

I'm not sure if this is the right place to post this issue...but here goes... I am converting a set of windows jobs from Control-M to AutoSys r11.3. The same command line is being executed in both systems. The Control-M job runs to compltion in about 1.5 hours, waiting for the entire batch... (3 Replies)
Discussion started by: ajomarquez
3 Replies

6. Shell Programming and Scripting

SQL PLUS Command 'ACCEPT' is not waiting for user input with sh shell script

Dear All, The sqlplus 'Accept' command is not waiting for user input when I include the command within a shell script. Note: The 'Accept' command is working fine if I execute it in a SQLPLUS Prompt. Please fins the below sample script which i tried. SCRIPT: -------- #!... (4 Replies)
Discussion started by: little_wonder
4 Replies

7. Solaris

Timed out waiting for Autonegotiation to complete

Received the Timed out message consistently when I tried to jumpstart an M5000 with: boot jsnet:speed=1000,duplex=full - install Made the error go away by adding link-clock parameter: boot jsnet:speed=1000,duplex=full,link-clock=master - install "link-clock=master" disables... (1 Reply)
Discussion started by: markoakley
1 Replies

8. Programming

parent not waiting until child complete executing another program through execl()

Hi, I am calling a program that greps and returns 72536 bytes of data on STDOUT, say about 7000 lines of data on STDOUT. I use pipe from the program am calling the above program. Naturally, I execute the above program (through execl() ) throught the child process and try to read the... (4 Replies)
Discussion started by: vvaidyan
4 Replies

9. UNIX for Advanced & Expert Users

Process(s) ID waiting on IO?

Hello Experts!! My CPU is waiting a lot (around 33%) on I/O. I would like to find out what process(s) are waiting on the i/o. Below is my real time output of vmstat and sar. Thanks for you help !!!! Regards Citrus OS: AIX - 5L : /u2/oracle >oslevel 5.3.0.0 : /u2/oracle... (9 Replies)
Discussion started by: Citrus143
9 Replies

10. Linux

waiting process

how to know the information of the waiting process how to calculate the time of the process that it has taken to execute i want to make a program that Should be able to keep a log of the processes expired(The log should contain the starting time, expiry time, time slices used, total execution... (2 Replies)
Discussion started by: shukla_chanchal
2 Replies
Login or Register to Ask a Question