Archive for October, 2009
LCOD 10.9.09 – Script to retry command
Posted by Jon Zobrist in Linux, Linux Command of the Day on October 9, 2009
I use this almost exclusively with trying to ssh to a machine that’s rebooting, but it’s useful to have, and, I think, should be included as a default command in any Linux distro.
Script : retry
Usage : retry command [args]
Code :
#!/bin/bash
while true
do
echo "trying $@ at `date`"
$@
sleep 1
done
Enjoy.