fanout, a super useful linux script if you manage multiple, similar servers

I love this fanout script for running the same command on multiple servers, just in case you’re interested:

http://www.stearns.org/fanout/fanout

[root@199564-6 scripts]# fanout "$SERVERS" "cp /root/.ssh/authorized_keys /home/user/.ssh/"<br /> Starting root@db1<br /> Starting root@db2<br /> Starting root@nas<br /> Starting root@www1<br /> Starting root@www2<br /> Starting root@www3<br /> Fanout executing "cp /root/.ssh/authorized_keys /home/user/.ssh/"<br /> Start time Wed Dec 23 23:45:35 EST 2009 , End time Wed Dec 23 23:45:47 EST 2009<br /> ==== As root on db1 ====

`==== As root on db2 ====

[root@199564-6 scripts]# echo $SERVERS<br /> root@www1 root@www2 root@www3 root@db1 root@db2 root@nas<br /> [root@199564-6 scripts]# echo $SERVERSWWW<br /> root@www1 root@www2 root@www3

A great way to execute the same commands on multiple servers… if you export the $SERVERS to a standard list, in your .bashrc or whatnot… it’s even easier. Of course, you’ll probably want to setup authorized_keys for your servers so that you don’t have to authenticate to each…