README.md in rcmd-1.6.1 vs README.md in rcmd-1.6.2
- old
+ new
@@ -28,10 +28,16 @@
-t, --threads threads Number of threads to run
-c, --command <command> Quoted string containing the command to be run
-q, --quiet Suppress stdout of commands. stderr will still be displayed
-v, --version Print what version of the command is in use
-D, --debug Print debug information
+
+Database Options
+ -C, --create-config Create template dbconfig file in ~/.rcmd
+ -T, --type server-type Database query on server type
+ -H, --host hostname-pattern Database query on hostname (sql like query)
+ -O, --os operating-system Database query on Operating System string
```
## Specifying nodes manually
Specifying a comma seperated list of hosts and timing the total execution time.
```bash
@@ -69,9 +75,74 @@
node8 :: node8.example.com
node7 :: node7.example.com
node11 :: CONNECT ERROR :: Unable to connect to host!
node9 :: node9.example.com
node12 :: node12.example.com
+```
+
+## Database backend support
+The database backend support is provided by ActiveRecord and thus
+compatible with databases which are supported by ActiveRecord.
+Currently the ActiveRecord version is locked to 4.0.0 in the Gemspec
+due to compatibilty issues with RHEL, CentOS, and Mac OSx to name a
+few.
+
+To set up the database backend run rcmd with the '-C' switch first.
+This will create a database configuration file in ~/.rcmd named
+dbconfig.yml. In this file you can specify the adapter, and various
+other soptions for the database backend. For the queries to work
+properly, the :host_field: *MUST* be set so the command knows what
+column contains the host name.
+
+Two optional fields exist as well, which are type_field and os_field.
+While these are meant to represent "Server type (I.e. Web, DB, etc)
+and Operating System Name/version, you can map these to whatever
+fields you would like to be able to sort by. If these fields are not
+specified then using the associated command line options will result
+in a run time error.
+
+To minimize the size and possible issues with various backend
+adapters, no adapters are listed/installed when installing this Gem.
+It is up to you to install the correct adapter for the database you
+are wanting to connect to.
+
+The '-T' and '-O' options use strict matching in their queries where
+as the '-H' option uses a 'LIKE' query.
+
+### Database backend examples
+
+Hostname query (Match all systems whose hostname starts with node and contains at least two additional charectors):
+```bash
+daibhidh@darkstar:~/$ rcmd -H 'node%_' -c 'hostname -f'
+node20 :: node20.example.com
+node10 :: node10.example.com
+node12 :: node12.example.com
+node13 :: node13.example.com
+node15 :: node15.example.com
+node16 :: node16.example.com
+node18 :: node18.example.com
+node17 :: node17.example.com
+node11 :: node11.example.com
+node19 :: node19.example.com
+node14 :: node14.example.com
+```
+
+Type query (Match all hosts listed as web servers):
+```bash
+daibhidh@darkstar:~/$ rcmd -T 'web' -c 'hostname -f'
+node11 :: node11.example.com
+node19 :: node19.example.com
+node14 :: node14.example.com
+```
+
+OS query (Match all hosts listed as running slackware):
+```bash
+daibhidh@darkstar:~/$ rcmd -o 'slackware' -c 'hostname -f'
+node10 :: node10.example.com
+node12 :: node12.example.com
+node18 :: node18.example.com
+node17 :: node17.example.com
+node11 :: node11.example.com
```
# Development
If you are wanting to modify the code by all means do so. If you clone this repository you can then run `bundle install` to install the dependencies needed. Tests are performed with *rspec* and can be run with *rake*.