!/bin/bash
start the background script, then find the pid
myscript.sh & myscript_pid=$! echo "do some stuff" kill -9 $myscript_pid
!/bin/bash
maybe someone else started the background script myscript
myscript_pid=$(pidof myscript) echo "do some stuff" kill -9 $myscript_pid
!/bin/bash
wait until both scripts are done, allow control + c termination
function continuous() { date myscript.sh & anotherscript.sh & wait || return }
while true ; do continuous 2>&1 | tee -a $LOG sleep 10 || break done