Wednesday, October 7, 2009

Execute remote command on multiple boxes oneliner

You'll have to have password less logon with ssh setup for these commands. In this case the blue command is creating symlinks and x has a list of user@host's

[cmbuild3@pghpscmbldl01 ~]$ cat x | xargs -i{} -t ssh {} '[ ! -e wad ] && ln -s /opt/g/ad/stat/wls/ad/; [ ! -e logs ] && ln -s /var/g/ad/logs/wls/ad/ logs '
[cm@pgh ~]$ cat x
adqas@qpada01
adqas@qpada02
adqas@qpada03
adqas@qpada04
etc

No comments:

Post a Comment