Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://hea-www.harvard.edu/~fine/Tech/multi-rsh.html
Дата изменения: Unknown Дата индексирования: Sun Apr 10 06:36:12 2016 Кодировка: Поисковые слова: о п п |
Multi-rsh must be run as root (remote jobs can be set to run as any user, see Options below). Note that control-C is used to report current status. You can use control-backslash to kill multi-rsh.
multi-rsh [options] "command [arg ...]" host [host ...]and
multi-rsh [options] -l filename comand [arg ...]In the first form, the command is a single argument, and must be in quotes according to your shell's own syntax if it includes it's own list of arguments. When the command is executed on the remote system, it will be parsed according to bourne shell (/bin/sh) syntax. (Make sure you properly quote the command to protect any special characters from being interpreted locally).
In the second form, the list of host comes from a file (which may be "-" to represent standard input), and the rest of the arguments are the command to run, and it's arguments. The remote command will also be parsed according to bourne shell (/bin/sh) syntax. (Make sure you properly quote the command to protect any special characters from being interpreted locally).
Neither form allows you to directly pass input to the remote programs. If this is needed, it should be done with Bourne shell redirection.
prompt# multi-rsh who host1 host2 host3 host4 host1: fine console Apr 26 3:13 host1: fine pts/1 Apr 26 3:14 host1: fine pts/3 Apr 26 3:14 host1: fine pts/4 Apr 27 11:51 host3: root console Apr 1 4:01 host4: multi-rsh timeout exceeded, attempting kill HUP 6543 prompt#This example demonstrates the same form, but a mulitple-parameter command:
multi-rsh "cp /etc/sendmail.cf /etc/sendmail.cf.orig" host1 host2 host3 host4This example demonstrates taking the host list from standard input.
ypcat hosts | grep foo | awk '{ print $2 }' | multi-rsh -l - grep SCSI /var/adm/messagesThis example saves the multi-rsh output to /tmp/output. Compare this command with the next.
multi-rsh -l /tmp/hostlist date > /tmp/outputThis command saves the output for each command into the remote machine's /tmp. Output to standard error will still be displayed locally.
prompt: multi-rsh -l /tmp/hostlist date \> /tmp/outputThis command throws away remote output that goes to standard error (and which would be rerouted to standard output otherwise). multi-rsh may still produce it's own output on standard error, although this is not common.
prompt: multi-rsh -l /tmp/hostlist date 2\>/dev/nullThis command saves the output for each command into a central repository, using different output names for each machine.
prompt: multi-rsh -l /tmp/hostlist date \> /nfs/public/output.\`hostname\`
Multi-rsh must be run as root. However, it allows you to set the user that the remote program will run as. Do NOT install this script set-uid root, as known security holes exist in the script if it is installed that way.
Download it now! (version 1.2)
Future enhancements may include: separating standard error; separate timeouts for connection setup and command completion; optional separate output files for each command.
Fine's Home |
|
Send Me Email |