7 ./deployfile.sh -f filename -p /path/to/destination/ [ -u remoteuser ] [ -b ] host1 [ host2 ... ]
10 -f Name of file to be deployed
11 -p Path on remote server where file should be deployed to
12 -u Username to use when logging into remote server; if not provided, defaults to current user
13 -b Backup flag (optional); creates a backup instead of overwriting file on remote server
14 -h Print this message and exit
18 while getopts ":f:p:u:bh" opt
24 b ) BACKUP="-b --suffix=.`date +%Y%m%d%H%M`";;
28 shift $(($OPTIND - 1))
30 if [[ -z "$FILE" ]] || [[ -z "$DEST" ]] | [[ $# -lt 1 ]]
45 RSYNC_DEST="${HOST}:${DEST}"
46 #echo -e "$HOST:\n\tFILE=$FILE\n\tDEST=$DEST\n\tUSER=$USER\n\tBACKUP=$BACKUP\n\tSSH=$SSH\n\tRSYNC_DEST=$RSYNC_DEST\n"
47 rsync -e"${SSH}" $BACKUP -avz $FILE $RSYNC_DEST