From: Robert Klemme Date: 2005-10-18T04:01:57+09:00 Subject: Re: starting a process after the previous one is done Partha wrote: > Corey, > When I do so, it does the same thing > I dont think ruby waits for the previous system command to be done > before it runs the next line. > ( They are concurrent?) No way: sytem is synchronous, i.e. ruby will block until it has finished. Try it: $ ruby -e 'system("sleep 10; echo 1");system("echo 2")' 1 2 > Ay other ideas of how I would be abel to wait on the previous process > to run the next one? If you see something different then maybe the processes you start are forking. For some programs usually started as daemon there's a flag that prevents running in the background. Maybe that can help you. Other than that, if your programms fork themselfes you need to find a way to determine execution state and wait to that status change. > Snippet shown below. What exactly do you want to demonstrate with this? > -rw-rw-r-- 1 pvn cad 0 Oct 17 10:27 1f_after > -rw-rw-r-- 1 pvn cad 61261 Oct 17 10:27 1f > > pvngemini/home/pvn >cat t.rb > #!/usr/local/bin/ruby -W > > print "Start\n" > system("ls -lrt /home/pvn > 1f") > system("touch 1f_after") You can't really expect timestamps with differnt minutes, can you? If you have GNU ls you can use option --full-time: Robert@Babelfish2 /c/TEMP $ touch 1 ; touch 2 Robert@Babelfish2 /c/TEMP $ ls -t --full-time 1 2 -rw-r--r-- 1 Robert Kein 0 2005-10-17 20:55:30.234375000 +0200 2 -rw-r--r-- 1 Robert Kein 0 2005-10-17 20:55:30.140625000 +0200 1 Robert@Babelfish2 /c/TEMP Kind regards robert