I want to create a script to start two different scripts in sequence.
The first script start an application server, which although the process has started (and i'm back at the prompt), it will only accept connection after a 'certain' message in its log; 'Server Blah Blah started!'.
The second script essential connects to the server and does some extra stuff.
How can i create a startup script such that the second script will only start after the first?
./script1 && ./script2
The && means "only execute the second part once the first part has completed successful, different to:
./script1; ./script2
Which does the first part, then the second part. Essentially though, without forking or threading (some methods have this inherently), pretty much all programming you do is imperative and does one thing (to the end) at a time. If you need to hold, write a WHILE in your language that loops until (whatever condition) is true.
A sample of how you would do what you want in perl.
With the above code it will only run the second program if the word was found once the first program finish printing it is output.
UPDATE: If the program does not output what you want but there is a log file where it will write the info you need, you can use it within perl aswell so your not limited at all.