Fixed up some missing data in -h output. Converted to a here doc instead of lots of echo statements.

This commit is contained in:
moreejt 2006-12-21 19:47:55 +00:00
parent f2624db0f9
commit 90ff0f8d3e

View file

@ -2,6 +2,7 @@
#LICENSE: Gnu GPL version 2 #LICENSE: Gnu GPL version 2
#Author: JT Moree: moreejt@pcxperience.com #Author: JT Moree: moreejt@pcxperience.com
#Copyright: Kahala Corp. 2006
#Date: 20061213 #Date: 20061213
# #
# $URL$ # $URL$
@ -10,58 +11,77 @@
VERSION="$Revision$ ($Date$)" VERSION="$Revision$ ($Date$)"
PROGRAM=`basename $0` PROGRAM=`basename $0`
DEBUG=n
ETC=/etc/clusterscp
CONF=/etc/clusters
RC=/etc/clusterscprc
GRP=
COMMENT=
DEST=
SYSLOG=0
usage() usage()
{ {
echo "$PROGRAM v. $VERSION" cat <<FOO
echo "Usage: $PROGRAM [options] -C<cluster> file1 file2 file3 . . ."
echo " or $PROGRAM [options] -H<user@host> file1 file2 file3 . . ." $PROGRAM v. $VERSION
echo Usage: $PROGRAM [options] -C<cluster> file1 file2 file3 . . .
echo "This program copies files to remote machines using ssh and scp and can log the action" or $PROGRAM [options] -H<user@host> file1 file2 file3 . . .
echo
echo "LICENSE" This program copies files to multiple remote machines using ssh and scp and can log the action.
echo " Released under the terms of the GNU GPL version 2"
echo LICENSE
echo "OPTIONS" Released under the terms of the GNU GPL version 2
echo " -C server cluster(s) to scp to. see GROUPS/CLUSTERS"
echo " -D destination directory on target servers" OPTIONS
echo " -d Debug mode" -C server cluster(s) to scp to. see GROUPS/CLUSTERS
echo " -H copy to this one host (format user@host)" -D destination directory on target servers
echo " -h help" -d Debug mode
echo " -f Use this config file for groups/clusters. Use this to override the use of clusterssh config in /etc/clusters." -H scp to this one host (format user@host)
echo " -t comment to describe the action" -h help
echo -f Use this config file for groups/clusters. Use this to override the use of clusterssh config in /etc/clusters.
echo "Make sure to use quotes when there are spaces in your params. " -t comment to describe the action
echo "And dont put a space between the switches and the params"
echo "ie. -Cfoo NOT -C foo" Make sure to use quotes when there are spaces in your params and dont put a space between the switches and the params.
echo ie. -Cfoo NOT -C foo
echo "GROUPS/CLUSTERS"
echo " This script uses scp to copy files to the specified destination of each server in a server cluster." GROUPS/CLUSTERS
echo "A server cluster is specified in a file (usually $CONF) in the format:"
echo " <clustername> <user>@<server> <user>@<server> . . . ." This script uses scp to copy files to the specified destination of each server
echo "See clusterssh for more info" in a server cluster. A server cluster is specified in a file (usually $CONF)
echo "Each cluster may also have custom configurations specified in a file ending with .cfg." in the format:
echo " ie. servers A, B, and C are in group FOO. There is a line in file $CONF" <clustername> <user>@<server> <user>@<server> . . . .
echo " FOO root@A root@B root@C" See clusterssh for more info
echo "and potentially another file $ETC/FOO.cfg"
echo Each cluster may also have custom configurations specified in a file ending with .cfg.
echo "CONFIG FILES" ie. servers A, B, and C are in group FOO. There is a line in file $CONF
echo "In the .cfg file vars can be set in the form of bash/sh vars:" FOO root@A root@B root@C
echo " LOG=/root/Documentation/changelog" and potentially another file $ETC/FOO.cfg
echo
echo "LOGGING to SYSLOG" CONFIG FILES
echo "The log string will use the format '20060111 11:11:11 user clusterscp:cluster:comment: <files>'"
echo "The script attempts to use logger (syslog) on each target machine. To turn this off" In the .cfg file vars can be set in the form of bash/sh vars:
echo "set the SYSLOG=0 config in $RC or in the .cfg for that cluster." LOG=/root/Documentation/changelog
echo
echo "LOGGING to a CUSTOM LOG" LOGGING to SYSLOG
echo "The log string will use the format '20060111 11:11:11 user clusterscp:group:comment: <files>'"
echo "The .cfg file can have a parameter set LOG=/path/to/log. If so, it logs the action" The log string will use the format
echo "to that file by appending to the end of it. " 20060111 11:11:11 user clusterscp:cluster:comment: <files>
echo The script attempts to use logger (syslog) on each target machine. To turn
echo "SSH w/o PASSWORDS" this off set the SYSLOG=0 config in $RC or in the .cfg for that cluster.
echo "If ssh public/private key authentication is setup with no passphrase then no password is neccessary to scp the files. Otherwise you will be prompted for each server password."
echo LOGGING to a CUSTOM LOG
The log string will use the format
20060111 11:11:11 user clusterscp:group:comment: <files>
The .cfg file can have a parameter set LOG=/path/to/log. If so, it logs the
action to that file by appending to the end of it.
SSH w/o PASSWORDS
If ssh public/private key authentication is setup with no passphrase then no password is neccessary to scp the files. Otherwise you will be prompted for each server password.
FOO
} }
copy_files() copy_files()
@ -122,16 +142,6 @@ copy_cluster()
fi fi
} }
DEBUG=n
ETC=/etc/clusterscp
CONF=/etc/clusters
RC=/etc/clusterscprc
GRP=
COMMENT=
DEST=
SYSLOG=0
#source global config file #source global config file
if [ -f $RC ] ; then if [ -f $RC ] ; then
. $RC . $RC