Odi's astoundingly incomplete notes
New entries | CodePID file in bash
To write the PID of a background process to file:
/usr/bin/program & echo $! > program.pidTo later check if the process is still running:
PID=$(cat program.pid) if [ -e /proc/${PID} -a /proc/${PID}/exe -ef /usr/bin/program ]; then echo "Still running" fi
`rsync -avpogtH --links --copy-unsafe-links user@remotehost:/remote/directory/ /Local/HD/ >> $logfile.`& echo $! > program.pid
waitpid=`cat program.pid`
wait $waitpid
...and repeat
Pol