Skip to content

Commit af98fdf

Browse files
committed
improve readme
Signed-off-by: Marc Schöchlin <[email protected]>
1 parent c9498ea commit af98fdf

File tree

1 file changed

+98
-113
lines changed

1 file changed

+98
-113
lines changed

README.md

Lines changed: 98 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -44,117 +44,115 @@ Invoke hostctl to execute commands or scripts on the specified hosts.
4444

4545
See also "EXAMPLES" section.
4646

47-
# Manpage:
48-
(output of "hostctl -h")
47+
# Help
48+
(output of "hostctl --help")
4949
```
50-
License - see: LICENSE.txt
50+
$ hostctl --help
51+
52+
Run a binary or example of the local package
53+
54+
Usage: cargo run [OPTIONS] [ARGS]...
55+
56+
Arguments:
57+
[ARGS]... Arguments for the binary or example to run
58+
59+
Options:
60+
--message-format <FMT> Error format
61+
-v, --verbose... Use verbose output (-vv very verbose/build.rs output)
62+
-q, --quiet Do not print cargo log messages
63+
--color <WHEN> Coloring: auto, always, never
64+
--config <KEY=VALUE> Override a configuration value
65+
-Z <FLAG> Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
66+
-h, --help Print help
67+
68+
Package Selection:
69+
-p, --package [<SPEC>] Package with the target to run
70+
71+
Target Selection:
72+
--bin [<NAME>] Name of the bin target to run
73+
--example [<NAME>] Name of the example target to run
74+
75+
Feature Selection:
76+
-F, --features <FEATURES> Space or comma separated list of features to activate
77+
--all-features Activate all available features
78+
--no-default-features Do not activate the `default` feature
79+
80+
Compilation Options:
81+
-j, --jobs <N> Number of parallel jobs, defaults to # of CPUs.
82+
--keep-going Do not abort the build as soon as there is an error
83+
-r, --release Build artifacts in release mode, with optimizations
84+
--profile <PROFILE-NAME> Build artifacts with the specified profile
85+
--target [<TRIPLE>] Build for the target triple
86+
--target-dir <DIRECTORY> Directory for all generated artifacts
87+
--unit-graph Output build graph in JSON (unstable)
88+
--timings[=<FMTS>] Timing output formats (unstable) (comma separated): html, json
89+
90+
Manifest Options:
91+
--manifest-path <PATH> Path to Cargo.toml
92+
--lockfile-path <PATH> Path to Cargo.lock (unstable)
93+
--ignore-rust-version Ignore `rust-version` specification in packages
94+
--locked Assert that `Cargo.lock` will remain unchanged
95+
--offline Run without accessing the network
96+
--frozen Equivalent to specifying both --locked and --offline
97+
98+
Run `cargo help run` for more detailed information.
99+
marc@frink(2024-11-17 22:39:07) ~/src/github/hostctl-rust [master]
100+
$ cargo run -- --help
101+
Compiling hostctl v0.1.0 (/home/marc/src/github/hostctl-rust)
102+
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.49s
103+
Running `target/debug/hostctl --help`
104+
convenient management and execution of command on groups of hosts
105+
106+
Usage: hostctl [OPTIONS] [ITEMS]...
107+
108+
Arguments:
109+
[ITEMS]... Groups or nodes for the iteration
110+
111+
Options:
112+
-c, --command <COMMAND> Command to execute. A ssh login is performed on the specified hosts and the specified command is executed on the remotehost [default: ]
113+
-e, --execute-local Execute as local command and add hostname to the command (Hostname will be appended to the command, or inserted where 'HOST' string is located in the string
114+
-r, --recipe <RECIPE> Recipe to execute. A recipe is a shellscript which defines recurring administration tasks. Recipes can be stored in $HOME/.hostctl/recipe/ or <hostctl-installation-path>/recipe/ and can be called by their basename. Alternatively, recipes can be called be their fully qualified path [default: ]
115+
-n, --nodes Specify hosts instead of groups
116+
-s, --show show group(s)
117+
-a, --array Output an array list od nodes
118+
-j, --json output hosts in json format
119+
-d, --debug debug mode
120+
-f, --forcecolor disable automatic detection of interactive usage and output colors always
121+
-q, --quiet reduce output, useful for aggregating output of multiple hosts
122+
-b, --batchmode
123+
-i, --inscreen <INSCREEN> start command/script screen session [default: ]
124+
-o, --optssh <OPTSSH> Add the arguments to the ssh command [default: ]
125+
-l, --login
126+
--sudo
127+
-t, --term
128+
-w, --wait <WAIT> wait a specified number of seconds before continuing at next host [default: 0]
129+
-p, --prompt ask after every execution, if hostctl should continue, retry, execute a shell or quit
130+
-m, --makeselection raise a prompt before each host which provides the possibility to confirm or skip the host or quit execution
131+
--log-level <LOG_LEVEL> The log level [default: info]
132+
-h, --help Print help
133+
-V, --version Print version
134+
135+
136+
EXAMPLES
51137
52-
53-
NAME
54-
hostctl - convenient management and execution of comand on groups of hosts
55-
56-
SYNOPSIS
57-
hostctl [OPTIONS] [GROUPNAMES]
58-
59-
To specify more than one <groupname>, specify groups separated by spaces
60-
or comma. Options and groupnames can be mixed. Options can be
61-
abbreviated if there are no ambiguities.
62-
63-
OPTIONS
64-
--command <command>
65-
Command to execute. A ssh login is performed on the specified hosts
66-
and the specified command is executed on the remotehost.
67-
68-
--executelocal <command>
69-
Execute a local command and add hostname to the command (Hostname
70-
will be appended to the command, or inserted where 'HOST' string is
71-
located in the string.
72-
73-
--recipe <name>|<path>
74-
Recipe to execute. A recipe is a shellscript which defines recurring
75-
administration tasks. Recipes can be stored in
76-
$HOME/.hostctl/recipe/ or <hostctl-installation-path>/recipe/ and
77-
can be called by their basename. Alternatively, recipes can be
78-
called be their fully qualified path.
79-
80-
--nodes
81-
Specify hosts instead of groups.
82-
83-
--debug
84-
debug mode
85-
86-
--quiet
87-
reduce output, useful for aggregating output of multiple hosts
88-
89-
--help
90-
show this manpage
91-
92-
--show
93-
show group(s)
94-
95-
--show --array
96-
list hosts suitable for array iteration
97-
98-
--login
99-
login to each host (sleep 1 second after every login, use STRG+c to
100-
terminate iteration)
101-
102-
--optssh <arguments>
103-
Add the arguments to the ssh command.
104-
105-
--batchmode
106-
batchmode, no password prompting (skip host if not ssh-key auth is
107-
possible)
108-
109-
--prompt
110-
ask after every execution, if hostctl should (c)ontinue, (r)etry,
111-
(s)hell, (q)uit
112-
113-
--makeselection
114-
raise a prompt before each host which provides the possibility to
115-
confirm, skip or quit execution
116-
117-
--inscreen <session>
118-
start command/script screen session (screen -x <session>, see 'man
119-
screen' or 'STRG+a :help')
120-
121-
--term
122-
Force pseudo-tty allocation (typically needed for tools which use
123-
(ncurses-)text-menus)
124-
125-
--wait <seconds>
126-
wait a specified number of seconds before continuing at next host
127-
128-
--prompt
129-
raise a prompt after each host which provides the possibility to to
130-
open a shell, re-execute, quit
131-
132-
DESCRIPTION
133-
hostctl is a generic tool which supports batched execution of tasks on
134-
groups of hosts.
135-
136-
EXAMPLES
137138
Show disk usage on all systems which belong to group 'foobar'
138139
"hostctl -c 'df -h' foobar"
139140
140-
Show a aggregated view of all cronjobs running on a cluster
141-
"hostctl -c "crontab -l -u www-user" webcluster01 -q | less"
142-
143141
Show disk usage on all systems which belong to group 'foobar', ask after
144142
every node what to do next
145143
"hostctl -p -c 'df -h' foobar"
146144
147145
Execute ncurses application 'top' on all systems which belong to group
148-
'foobar'
146+
'foobar' using a pseudo tty
149147
"hostctl -t -c 'top' foobar"
150148
151-
Copy files using rsync to a remotehost
152-
"hostctl -e 'rsync -avP /tmp/foo HOST:/tmp/bar' foobar"
149+
Copy files using rsync to a remotehost by replacing the string HOST with the
150+
current hostname of the systems
151+
"hostctl -e -c 'rsync -avP /tmp/foo HOST:/tmp/bar' foobar"
153152
154153
Execute script/recipe 'apache_status' on all systems which belong to
155-
group 'foobar'
154+
group 'foobar' (shortcut or explictit path)
156155
"hostctl -r apache_status foobar"
157-
158156
"hostctl -r /foo/bar/baz/apache_status foobar"
159157
160158
Login sequentially on all hosts which belong to group 'foobar'
@@ -163,27 +161,14 @@ EXAMPLES
163161
Start a screen session with 'top' on all systems which belong to group
164162
'foobar'
165163
"hostctl -c 'top' --inscreen my-magic-screen foobar"
166-
167164
"screen -x my-magic-screen"
168165
169-
ENVIRONMENT VARIABLES
170-
HOSTCTL_CONFIG
171-
Define a alternate configuration location
172-
173-
Default search order: ~/.hostctl/hostctl.conf, <HOSTCTL BINARY
174-
DIRECTORY>/hostctl.conf
175-
176-
HOSTCTL_CONFIG_DYNAMIC_SCRIPT
177-
Get additional group definitions by reading stdout of the given
178-
script
166+
ENVIRONMENT VARIABLES
179167
180-
BUGS
181-
features :-)
182-
183-
AUTHOR
184-
Marc Schoechlin <[email protected]>
168+
HOSTCTL_CONFIG
169+
Define a alternate configuration location directory
185170
186-
Marc Schoechlin <[email protected]>
171+
Default search order: ~/.hostctl/hostctl.conf, <HOSTCTL BINARY DIRECTORY>/hostctl.conf
187172
188173
```
189174

0 commit comments

Comments
 (0)