Hi All,
At present I am using a UNIX Script which is running a set of JOBS. These JOBS are to be repeated for 20 times, means the same set of JOBS are repeated by just passing different arguments (From 1 to 20).
Is there any way by which I can execute them parallel?
At present its all sequential process of executing the same set of JOBS one at a time.
Run it in the bg as below:
script.sh arg1 &
script.sh arg2 &
script.sh arg3 &
script.sh arg4 &
....
Many thanks for this help .
I have done these changes and it worked.
Only thing which I have noticed that after I call papallel execution as
script.sh arg1 &
script.sh arg2 &
script.sh arg3 &
script.sh arg4 &
The prompt is not coming in UNIX (KSH Prompt) and I have to explicitly hit an Enter key.
May be since I am executing the parallel processes and hence the issue. Is there any way by which I can return the prompt after all the parallel executions?
Ideally, when we run a job in the background, the shell should immediately return a PID of the job and the command prompt should return to accept another command.
If the script immediately returns the output to the terminal, you might need to hit enter to come back to the prompt. To avoid this, you can redirect the o/p and std error to the appropriate files.
ex
script.sh arg4 > outfile 2>/dev/null &
cheers,
Devaraj Takhellambam
Or I guess you can try
nohup ................ &
This should help.
Thanks and Regards,
Gideon.