Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

asked on

running two .ksh at exact same time

hi guys

I have

job_RAT.ksh and
job_SWD.ksh

when i run them individually like
./job_RAT.ksh  dev test

./job_SWD.ksh  dev test

they work fine

My requirment is to run the above two .ksh files at exact same time.
I dont have crontab facility enabled at work so crontab scheduling is not an option.

So what i did is create a parent.ksh file and put them like this


#!/bin/ksh
#

./job_RAT.ksh  dev test

./job_SWD.ksh  dev test

exit 0

Open in new window


but it says

./job_RAT.ksh: not found [No such file or directory]
./job_SWD.ksh: not found [No such file or directory]

any idea what is the solution to it ?
and will they run at same time ?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi, both suggestions above work but they start the 2nd process after the first process was started. Question: how exact do you want them started (at the same time)?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tintin
Tintin

>Hi, both suggestions above work but they start the 2nd process after the first process was started.

Yes, but with a fraction of a millisecond delay, which is close to being exactly the same time.
You cannot guarantee that they start at the same time. library linking takes some cpu cycles...
TinTin, Gheist - agreed, hence my question how exact OP wants the scipts to start. If just running them in parallel is required then & solutions will do fine. But if you try the xargs way you'll see that sometimes the 2nd script gets to output some text first, I've created 2 simple scripts that just echo some text and sleep some time.
Linux is a timesharing system. Small time slices make illusion that all processes run smoothly all the time.
"Start at the same time" is not very stable. first they load dynamic libraries, then some code starts to run. Given small perturbations in task scheduler one that was started us earlier may print first line ms later.
Avatar of Jay Roy

ASKER

thanks for all the responses, Since we were already using Autosys, we could schedule it using Autosys tool and run the process at the same time (however there was a millisec difference , which i dont think can be avoided).
When they run "at the same time" they need couple of disk spins to load executables (if they are loaded the memory space gets shared and no disk access happens). That brings accuracy more into centisecs range. As you see starting same second goes very well with both autosys and cron...