Freitag, 2. Dezember 2011

Using DSH (a very simple Linux example)

DSH is a handy tool to connect to multiple computers simultaneously to perform tasks. Not being able to find a most simple example on this issue, drove me fucking nuts.. So, here it is:


Goal: I have saved the IP addresses of some computers into a file. Execute the command "cat /etc/hostname" on every computer that is listed in this file.

 Content of a file called "targets":

192.168.1.122
192.168.1.123
192.168.1.124
192.168.1.125

Command:
dsh -f ./targets -c -- "cat /etc/hostname"

Output:
192.168.1.122: alpha
192.168.1.123: delta
192.168.1.124: sierra
192.168.1.125: client


Keine Kommentare:

Kommentar veröffentlichen