Script that waits for process to complete


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script that waits for process to complete
# 1  
Old 08-27-2014
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 tool takes anywhere from 5 to 15 minutes to complete. Running this executable takes the following form:

Code:
/path/to/exec/synctool <couple of switches> "/folder/to/scan"

I was wondering if it would be possible to script this with the intention of
A. being able to read a list of folders to scan (there may be up to 30 different folders that this tool has to scan). I can easily generate this text file.
B. Run one instance of the tool and monitor it to see when it completes.
C. Run again for the next folder and so forth until all folders are scanned.

Thanks!
# 2  
Old 08-27-2014
Try:
Code:
while read -r dir
do      /path/to/exec/synctool <couple of switches> "$dir"
done < /path/to/file/containing/list/of/directories/to/process

# 3  
Old 08-27-2014
Sth like
Code:
while read folder_to_scan
  do /path/to/exec/synctool <couple of switches> "$folder_to_scan"
  done < list_of_folders_to_scan

?
# 4  
Old 08-27-2014
I thought of that type of script but will that actually wait for the first instance of the tool to finish and then run the next instance?

I guess I'm just being a tad paranoid...haha.
# 5  
Old 08-27-2014
The script waits until synctool is finished.
If synctool immediately finishes, putting the actual scan job into the background, then - bad luck.
# 6  
Old 08-27-2014
I believe it actually continues to run because I currently am running one folder at a time and then watching TOP until the process goes away. Then I move to the next folder.

Thank you for the easy suggestion!
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

Need generic command to get complete running process details

I am on SunOS and Linux I need generic command to get complete process details from which i will eventually extract socket details (listen address and port) ps -ef | ggrep -i server | ggrep -i mydomaindoes not yield a process that should have both the grep entries along with the listen... (8 Replies)
Discussion started by: mohtashims
8 Replies

3. UNIX for Dummies Questions & Answers

Stop blinking text after process is complete

Trying to make some blinking text to designate a process taking place. Trying to figure out how when the process is complete how to end the blinking. I could clear out but then I lose any prior output which I don't want. echo "Archiving Files..." printf "\x1b (10 Replies)
Discussion started by: wyclef
10 Replies

4. Shell Programming and Scripting

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... (3 Replies)
Discussion started by: Prashanth19
3 Replies

5. Shell Programming and Scripting

Ensure file copy is complete before starting process

Hi experts, I have a requirement wherein a user is uploading a file to the Landing directory on one of our Linux servers. A cron job is scheduled to run after every 5 minutes which will pick up the files from the source (Landing) dir and copy to the target dir, and once successfully copied to... (4 Replies)
Discussion started by: adi_2_chaos
4 Replies

6. Shell Programming and Scripting

Script that waits until a call is done

Hi all, I have a script that checks for the existence of files in a directory. Problem is, if a file suddenly appears, I need to move it to another directory and then call another program that does not import routines (within our DBMS). Now, this script is ever running and uses the sleep... (3 Replies)
Discussion started by: gseyforth
3 Replies

7. Shell Programming and Scripting

shell script executes program, but waits for a prompt

Sorry, newbie here. I have the following shell script which basically executes the sh-n-body.i686 program a specified number of times. However, before the sh-n-body.i686 begins its calculations it prompts for input from the user. In this case the user would have press ". return" and... (7 Replies)
Discussion started by: lionatucla
7 Replies

8. Shell Programming and Scripting

Wait for Background Process to complete

I am attempting within a for-loop, to have my shell script (Solaris v8 ksh) wait until a copy file command to complete before continueing. The specific code is: for files in $(<inputfile.lst) do mv directory/$files directory/$files ksh -m -i bg %% wait $! done I am shaky on the... (3 Replies)
Discussion started by: gozer13
3 Replies

9. Shell Programming and Scripting

PERL: wait for process to complete

I'm using PERL on windows NT to try to run an extract of data. I have multiple zip files in multiple locations. I am extracting "*.t" from zip files and subsequently adding that file to one zip file so when the script is complete I should have one zip file with a whole bunch of ".t" files in it. ... (2 Replies)
Discussion started by: dangral
2 Replies

10. Filesystems, Disks and Memory

some process writin file - check if complete

Hi folks... some process is writing a file.... as soon as the process starts the file comes there, and its growin.. now i in another script want to ftp the file. i don't know if the file is complete or not. the process which writes the file is some other application and hence can't... (0 Replies)
Discussion started by: sade
0 Replies
Login or Register to Ask a Question