Operating System - HP-UX
1827243 Members
2319 Online
109716 Solutions
New Discussion

Re: running synchronized scripts

 
jojo_4
New Member

running synchronized scripts

Hello,

I would like to execute two scripts in parallel in order to gain time.

Is it link to one of the following syntax?


GENERAL SCRIPT:

. $HOME/bin/script1
. $HOME/bin/script2

or

ksh $HOME/bin/script1
ksh $HOME/bin/script2


Thanks a lot.

Regards,


5 REPLIES 5
Steve Steel
Honored Contributor

Re: running synchronized scripts

Hi

$HOME/bin/script1&
$HOME/bin/script2&
wait

In a script will do it.

Whatever you try never forget the wait.

Then shell will continue when they are both finished.

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Trond Haugen
Honored Contributor

Re: running synchronized scripts

If you want to run two scripts in paralell you have to start at least the first as a background job with a '&' as that's the only way to give you a prompt to start the second.

$HOME/bin/script1 & $HOME/bin/script2

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
jojo_4
New Member

Re: running synchronized scripts

And what are the differences between
. $HOME/bin/script1

and

ksh $HOME/bin/script1


Thanks.

Ralph Grothe
Honored Contributor

Re: running synchronized scripts

The dot is short for the source command,
i.e. the suppllied script is sourced into the current shell.
This syntax is mainly used to set an environment and define some functions (e.g. a script library) which can be used from the sourcing shell or script.
Madness, thy name is system administration
Martin Johnson
Honored Contributor

Re: running synchronized scripts

You could also submit them to batch. Do a "man at" for details.


Marty