-
Notifications
You must be signed in to change notification settings - Fork 2
/
usage.txt
43 lines (33 loc) · 2.05 KB
/
usage.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
In order for this script to work you need to install it in some directory (for example /usr/local/bin).
And then create 5 symlinks to it:
1. ln -s /usr/local/bin/multy-command.sh /usr/local/bin/sexec
2. ln -s /usr/local/bin/multy-command.sh /usr/local/bin/mexec
3. ln -s /usr/local/bin/multy-command.sh /usr/local/bin/fexec
4. ln -s /usr/local/bin/multy-command.sh /usr/local/bin/scopy
5. ln -s /usr/local/bin/multy-command.sh /usr/local/bin/mcopy
This present us with 5 different commands residing in one single script. This way we can easly change
all the commands at once.
Some information about the commands:
sexec - Sequential execution of a certain command on all servers from $server_list
mexec - parallel execution of a certain command on all servers from $server_list performed in background
fexec - parallel execution of a certain command on all servers from $server_list performed in background
but print the output with the hostname of every machine, so we can get better ordered output
scopy - Sequential copy of a certain file to all servers from $server_list, this is usefull for files
bigger then 2-3MB
mcopy - parallel copy of a certain file to all server from $server_list, this is usefull for transfering
configuration files and archives under 2MB
The mexec and sexec commands can also be used to execute local scripts on the remote servers:
Usage: $0 command|- script_file
The - script_file option can be used only with mexec and sexec.
Examples:
$0 - script.sh
So all *exec commands can be used with a command as:
$0 'cp /etc/exim.conf /etc/exim.old'
But only sexec and mexec can be used with scripts like:
$0 - script.sh
The copy commands can be used as:
Usage: $0 local_file remote_destination
Example:
$0 test.sh /usr/local/sbin
If you specify a file in the SERVER_LIST environment variable, the contents of that file will be used as the server list.
If you specify a number in the BACKGROUND_SLEEP_TIME environment variable, that number will be used to wait for s/m/fexec commands, before producing the server status information.