Often, I have long running jobs on various headless machines. Sometimes, I am eager to get the results, but get tired watching the console. Therefore, I wrote a small shell script that will send me an ICQ message once the job is done. To distinguish between several jobs, the message contains the original command and the last 10 lines of the result. This script takes another command as paremeter and also prints out the command’s stdout and stderr.
echo "msg NICK" > $SINK
echo "command: \"$@\":" > $SINK
tail > $SINK
echo "." > $SINK
$@ |& tee >(doReport $@)
It also requires a running instance of mICQ under the specified username. Due to the nice scripting interface of mICQ, automated sending of messages is made extremely easy. You have to replace NICK with the intended receiver’s nickname in mICQ.