So I develop my server app and some client apps for it. After each rebuild I start my server (which tends to load qup all services for something like 2 seconds) and then I start my clients... So his is what I have in my script:
cd $RUN_DIR
nohup ./CloudServer >& /dev/null &
sleep 5
nohup ./CloudClient --server=localhost --username=$ROBOT1_NAME --robot >& /dev/null &
nohup ./CloudClient --server=localhost --username=$ROBOT2_NAME --robot >& /dev/null &
I wonder are there any alternatives for sleep in Bash? Like wait at least 5 seconds and then until CPU activety on process X will go down to 1% and then launch what I need?