Menu

COMMAND_RCMD_RUN

Carlos Celso de Almeida

Return HOME or USAGE

Name

rcmd - Parallel Remote Command based SSH Command

run_Command

Execute command on the clients (by ssh command).

The 'run' options is not required, is the default.

 # rcmd [-run] [options] [nodelist]
   (execute commands)
 or
 # rcmd [options] [nodelist]
   (execute commands)

run_Options

command-file, index, nonode, showrc, summarize, wait

Command_Options

attempts, maxthreads, non-iteractive, stderroff, stdoutoff, timeout,
tracking

ssh_Options

ssh-cipher, ssh-command, ssh-enable-tty, ssh-login, ssh-port,
ssh-private-key, ssh-logwarn, ssh_options,

Generic_Options

ignorelist, nodelist, node-status, noheaders, notitle, options, output,
system, tags, with-status, without-noanswer-notify

Sudo_Option

The 'use-sudo' option is valid for 'sh', 'bash' and 'ksh' program script
only. The module will add the following lines on the top of script:

 export SUDO; SUDO=`which sudo`;

You can prefix '$SUDO' to system commands to grant root privileges. You
does not need to grant root privileges for all each line of script, just
specific the '$SUDO' in the commands if need.

REMEMBER: The 'Sudoers' must be configured. no autoconfiguration will be
done.

System Command Dependencies

The following command may require 'root' privileges. The 'root'
privileges depend of the system type, system configuration and remote
user in use. See the your system guide for more information.

Required commands on AIX Systems

 /usr/bin/hostname   Hostname
 /usr/bin/oslevel    OS Level
 /usr/bin/uname      Platform System Information
 /usr/sbin/bootinfo  (root) BOOT information
 /usr/sbin/lsattr    (root) List attributes
 /usr/sbin/lscfg     (root) List configuration
 /usr/sbin/lsdev     (root) List devices
 /usr/sbin/odmget    (root) List ODM
 /usr/sbin/prtconf   (root) Print system Configuration

Required commands on Linux Systems

 /sbin/lspci          (root) List PCI devices
 /usr/bin/getconf     (root) Get System Config
 /usr/bin/hostname    Hostname
 /usr/bin/lscpu       (root) List CPU
 /usr/bin/uname       Platform Information
 /usr/sbin/dmidecode  (root) HW decode tools

Required commands on SunOS and Solaris Systems

 /usr/bin/hostname         Hostname
 /usr/bin/isainfo          ISA Information
 /usr/sbin/prtconf         (root) Print system Configuration
 /usr/sbin/prtdiag         (root) Hardware information
 /usr/sbin/psrinfo         (root) Processor information
 /usr/bin/uname            Platform Information
 /opt/SUNWsneep/bin/sneep  (root) SerialNumber

Sudoers Configuration

The 'Sudoers' will be required for non-root remote users that does not
have root-privileges (see: System Command Dependencies). The lines
bellow can be used as an example for 'how to configure sudoers'.

To enable the sudoers use the 'use-sudo' option or edit the
/etc/rcmd.d/rcmd.conf and add the line

 # rcmd -use-sudo ...
 or
 #/etc/rcmd.d/rcmd.conf
 ...
 set USE_SUDO 1

Edit the '/etc/sudoers' and add the lines:

 # AIX Systems
 [user] ALL=(ALL) NOPASSWD: \
                  /usr/sbin/bootinfo, \
                  /usr/sbin/lsattr, \ 
                  /usr/sbin/lscfg, \  
                  /usr/sbin/lsdev, \  
                  /usr/sbin/odmget, \ 
                  /usr/sbin/prtconf

 # Linux Systems
 [user] ALL=(ALL) NOPASSWD: \
                  /sbin/lspci, \
                  /usr/bin/getconf, \
                  /usr/bin/lscpu, \
                  /usr/sbin/dmidecode

 # SunOS/Solaris Systems
 [user] ALL=(ALL) NOPASSWD: \
                  /usr/sbin/prtconf, \
                  /usr/sbin/psrinfo, \
                  /usr/sbin/prtdiag, \
                  /opt/SUNWsneep/bin/sneep

run_Examples

 1) Execute commands using 'nodelist' option.

 # rcmd -nodelist node1,node2 [command]

 2) Execute commands on node1 and node2 as first word as nodelist

 # rcmd [node1,node2] [command]

 3) Execute comands on all linux ignoring a list of nodes

 # rcmd -system system=linux -ignore node1,node2 [command]

 4) Execute all nodes with user's tag tag1 value.

 # rcmd -tag tag1 [command]

 5) Execute the 'pwd' command on all linux with checksum

 # rcmd -system syste=linux -sum 'pwd'

 6) Execute the 'command-file' script:

 # rcmd -command-file /tmp/myscript node1,node2

 7) Execute only enabled nodes

 # rcmd -node-status=enable '*' 'pwd'

NOTE: The '*' is required. The list of node is based on 'enabled node
state' in 'rcmd database'.

 8) Execute testing multiple ssh-keys

 # rcmd \
        -ssh-key /myfolder/.ssh/id_dsa \
        -ssh-key /myfolder/.ssh/id_rsa \ 
        -ssh-key /myfolder/.ssh/id_ecdsa \
        -ssh-key /myfolder/.ssh/id_ed2519 \
        [nodes] [command]

 9) Execute testing ssh-keys usiging distinct folders

 # rcmd \
        -ssh-key /folder1/.ssh/id_rsa \
        -ssh-key /folder2/.ssh/id_rsa \ 
        [nodes] [command]

 10) Using additional options

 # rcmd \
        -ssh-option 'PubkeyAcceptedKeyTypes=+ssh-rsa' \
        -ssh-option 'HostKeyAlgorithms=+ssh-dss' \
        [nodes] [commands]

NOTE: you can add the 'ssh-option' inside config file for persistence
purpose.

 11) Using limit time to run

 # rcmd -nop -time-exec 5 node1 'sleep 10; echo OKAY'
 node1: Command time exceeded

 # rcmd -nop -time-exec 15 node1 'sleep 10; echo OKAY'
 node1: OKAY

 12) Using 'nodelist' and 'nonode' options

# rcmd -nop -nodelist=node1,node2 -nonode ls /tm
(the arg1 --ls-- is part of command to run)

# rcmd -nop -nodelist=node1 node2 ls /tmp
(the arg1 --node2-- is part of nodelist to run)

ENDED


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.