mimo78 Posted March 7, 2007 Share Posted March 7, 2007 Is there a way to wait for a run command to complete without using runwait? I am working on a "deploy apps to workgroups machines" and ran into a problem... I have 2 installations I have to run on 2 remote hosts. For now the programs and hosts are hardcoded into the script I thought I could use the stderrread or stdoutread to control when they are finished but I can't What It currently does: run both programs on both hosts at the same time. what I want: run both programs on both host 1 at a time. (so when the first program has finished on both host we are ready to run the 2nd program on both hosts. If i use runwait I can only run 1 instance at a time. So it would be run program 1 on host 1, run program 1 on host 2, run program 2 on host 1 and finaly run program 2 on host 2 (having about 100 computers that needs installation of office programs, graphical programs, etz this will be very time consuming to say at least) therefore I have to wait for the first program to finish run on both hosts, before moving to program 2 on both hosts Hope anyone can answer my question as english is not my first langui. if not Ask and I will try to explain my code in it's current state: CODE#include <GUIConstants.au3> #include <array.au3> dim $program_queue[2] $program_queue[0] = "testprog.exe" $program_queue[1] = "testprog2.exe" _ArrayDisplay( $program_queue, "programs to run" ) dim $client_queue[2] $client_queue[0] = "\\test-pc" $client_queue[1] = "\\test-pc2" _ArrayDisplay( $client_queue, "Clients to run on" ) $serverpath = "\\server\Programmer\!DEPLOY" $username = "Admin" $password = "fejlkode47" ;$host = "\\test-pc" $i=0 while $i < 2 $program = $program_queue[$i] while 1 for $Client in $client_queue $install = install($client, $username, $password, $serverpath, $program) $SERR = StderrRead($install) $SOUT = StdoutRead($install) next if $SOUT="" then exitloop wend sleep(15000) ; wait for program 1 on both clients to finish, before proceeding $i = $i +1 wend MsgBox(4096, "STATUS:", "DONE") exit Func install($host, $username, $password, $serverpath, $program) $command = "psexec " &$host &" -u " &$username &" -p " &$password &" -i -c " &$serverpath &"\" &$program run($command,"",@SW_MAXIMIZE, 2 + 4) ;return $command ;DEBUGGER EndFunc Best Regards Mimo Link to comment Share on other sites More sharing options...
/dev/null Posted March 7, 2007 Share Posted March 7, 2007 Run() returns the PID of the process. Start your tasks, record the PIDs and then check if the process are still running with ProcessExists(). __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now