tomahawk [options] command
tomahawk is a program that enables to execute a command into many hosts.
$ tomahawk -h host1,host2,host3 uptime
—> ‘uptime’ command will be executed in host1, host2, and host3 with following output.
oinume@host1 % uptime
22:41:27 up 10 days, 3:26, 1 users, load average: 1.11, 1.13, 1.11
oinume@host2 % uptime
22:41:28 up 20 days, 4:26, 2 users, load average: 2.11, 2.13, 2.11
oinume@host3 % uptime
22:41:29 up 30 days, 5:26, 3 users, load average: 3.11, 3.13, 3.11
tomahawk executes a command via ‘ssh’. You can specify options for ssh with -o/–ssh-options and can configure ssh behavior with $HOME/.ssh/config.
-h option enables you to specify hosts, another option ‘-f’, which is specifying hosts files. hosts file is listing host names like this
host1
host2
host3
#host4
Starting with “#” means commenting the host out.
tomahawk executes commands via shell(/bin/sh), so you can use ‘|’ (pipe), ‘&&’, ‘||’ operators and so on.
$ tomahawk -h host1,host2 'ps auxww | grep python'
These programs follow the usual GNU command line syntax, with long options starting with two dashes (‘–’). A summary of options is included below. For a complete description, see the Info files.
Specifies host names for sending commands. You can specify multiple hosts with ‘,’.
Specifies hosts files which listed host names for sending commands. You can specify multiple hosts files with ‘,’.
Format of hosts file is below.
web01
web02
#web03
web04
A line of starting with ‘#’ disables a host.
DUPLICATED. Use -P/–prompt-password. Will be deleted in v0.6.0
Prompts a password for ssh authentication at first. If the password is all the same between target hosts, you’ll input a password just once.
Read a SSH password from stdin instead of prompting.
Prompts a password for sudo.
Continues to send commands even if any errors. The default behavior is fail-safe, means that tomahawk will stop if any errors.
Specifies a number of processes for parallel command execution. (default: 1) If your machine has multiple cpu cores, –parallel 2 .. N might be faster.
Specifies timeout seconds for a command.
DUPLICATED. Use t (-timeout) instead. Will be deleted in v0.6.0.
Specifies ssh user. The default is a current logged in user.
Specifies ssh options.
Specifies command output format. The default is '${user}@${host} % ${command}\n${output}\n'
Verify command output of all hosts. For additional information, see Checking files on remote hosts
Specifies configuration file path. For additional information, see Omit command line options by a configuration file.
tomahawk’s behavior is affected by the following environment variables.
This variable specifies an environment of ‘production’, ‘testing’ or ‘development’. If TOMAHAWK_ENV=production specified, tomahawk or tomahawk-rsync prompt as “command “%s” will be executed %s hosts. Are you sure? [yes/NO]: ”. The environment variable exists for mis-execution of a command.