10-24-2007
finding Background Process Id
Hi Gurus,
How can i find background process is completed or not. I have mentioned my scenario below.
Actually Pr1 Process is running in back ground, i just want to know whether this process completed or not. I can come to know the process id by typing pid=$! but i want to trigger that pr1 process in back ground and then after 10 min i want to trigger Pr2 Process. Actually Pr1 Process will take around 2 Hr time. i don't want to wait till 2Hrs, by writing wait $pid where $pid=$!.
script:
*****
x=`1 2 3 4 5`
for y in $x
do
if [ $a -eq 0 ]
then
./$Home/script_1.sh &
pid_1=$!
wait $pid_1
elif [ $b -eq 0 ]
then
./$Home/script_2.sh &
pid_2=$!
wait $pid_2
fi
sleep 15
done
here n this case for every 15 sec i want to run the scripts which has completed its process. in this case first it will run script_1.sh then it will wait for the process to complete then it triggers the script_2.sh but i don' t want to wait till script_1.sh completes. For every 15sec i want too run which ever is free i.e if for after 45 sec script_1.sh is completed its processing the it shuld run.
Please help me on the same.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello all,
How do I start a background process and save the process id to a file on my system. For example %wait 5 & will execute and print the process id. I can't figure out how to get it to a file. I've tried: > filename 0>filename 1>filename.
Any assistance is most appreciated.
Thanks,
Jim... (10 Replies)
Discussion started by: jleavitt
10 Replies
2. Programming
I have made a shell that accept a command and parameters. It is working properly. I have tryed to implement background process in main(). But i dont know to implement them. Can anyone give me a lille example??
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/* The following... (3 Replies)
Discussion started by: badshah
3 Replies
3. Shell Programming and Scripting
Hi Guys,
I am facing some weird problem with my shell script. The script shows up a menu and for every ontion internally calls a shell script which start/stop various servers. When I am using '&' while calling the internal shell script so that the server run in the background. For exiting... (1 Reply)
Discussion started by: agoyal
1 Replies
4. Shell Programming and Scripting
Hi,
In shell script when I use
script1 >> filelog
the echo statments of script1 gets printed in the filelog
but when I try to run script in background i.e,
script1 & >> filelog
nothing gets printed in the filelog.
Anybody knows whats going on here.
thanks (3 Replies)
Discussion started by: k_oops9
3 Replies
5. UNIX for Dummies Questions & Answers
How, can I hide background process's output? (5 Replies)
Discussion started by: zylwyz
5 Replies
6. Shell Programming and Scripting
can anybody plz tell me
how can i find the background processes running. (2 Replies)
Discussion started by: Raom
2 Replies
7. Shell Programming and Scripting
How to create a backgrond processes ? (5 Replies)
Discussion started by: anupdas
5 Replies
8. UNIX for Dummies Questions & Answers
What I need to learn is how to use a script that launches background processes, and then kills those processes as needed.
The script successfully launches the script. But how do I check to see if the job exists before I kill it?
I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies
9. Shell Programming and Scripting
Hi,
I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming.
So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Discussion started by: vanitham
5 Replies
10. Shell Programming and Scripting
Hi,
I have written a menu driven shell script in which as per the choice, I run the another script on background.
For eg:
1. get info
2)process info
3)modify info
All the operations have different scripts which i schedule in background using &.
However I wish to display the error... (0 Replies)
Discussion started by: ashima jain
0 Replies