domenica 4 maggio 2014

Script to wait until execution of a background process has ended.

Hi all

Today a simple script. 
If you need execute a process (for example script1.sh) and wait his termination to start execution another process (for example script2.sh) here a simple solution :

#!/bin/ksh

echo ' Start script1.sh '

./script1.sh > /dev/null &
VAR=$!
echo 'PID ' $VAR
wait $VAR

echo 'Finish script1.sh' 
echo ' Start script2.sh '

./script2.sh > /dev/null &
VAR=$!
echo 'PID ' $VAR
wait $VAR


echo 'Finish script2.sh' 

An important command for this application is wait which pauses until execution of a background process has ended.

Stay Tuned.

Check first quarter 2024

 Hi all Today, 1st May I'll check my 2024 goals. This is the first time I check it. For me it's a good way to reach more objective p...