tape-admin: adapt parse options

* prepare option for remote execution via ssh

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
2018-10-05 23:54:27 +02:00
parent 31a6d467ef
commit 3d5f496b05

View File

@@ -1216,10 +1216,10 @@ parse_params () {
shift $count shift $count
cmd=add-retensiondays cmd=add-retensiondays
;; ;;
--dry-run|--dryrun) #--dry-run|--dryrun)
dryrun=1 # dryrun=1
shift 1 # shift 1
;; # ;;
--get-lastwrite) --get-lastwrite)
shift 1 shift 1
pool_params=${*} pool_params=${*}
@@ -1454,14 +1454,14 @@ parse_params () {
shift $count shift $count
cmd=mtx-unload cmd=mtx-unload
;; ;;
-p|--port) #-p|--port)
port=$2 # port=$2
shift 2 # shift 2
;; # ;;
--remote) #--remote)
remote=$2 # remote=$2
shift 2 # shift 2
;; # ;;
--use-mtx) --use-mtx)
use_mtx=1 use_mtx=1
shift 1 shift 1
@@ -1551,10 +1551,10 @@ parse_params () {
esac esac
shift shift
;; ;;
--remote=*) #--remote=*)
remote=${1#*=} # remote=${1#*=}
shift # shift
;; # ;;
--v=* | --verbose=*) --v=* | --verbose=*)
verbose=${1#*=} verbose=${1#*=}
shift shift
@@ -1574,14 +1574,14 @@ parse_params () {
esac esac
done done
if [ -z "$remote" ]; then #if [ -z "$remote" ]; then
ssh="" # ssh=""
else #else
ssh="ssh $remote" # ssh="ssh $remote"
if [ ! -z "$port" ]; then # if [ ! -z "$port" ]; then
ssh="$ssh -p $port" # ssh="$ssh -p $port"
fi # fi
fi #fi
if [ "$color" ]; then if [ "$color" ]; then
# ascii color # ascii color
@@ -1600,14 +1600,14 @@ parse_params () {
printf " ltfs mount-point: '%s'\n" "$ltfs_mountpoint" printf " ltfs mount-point: '%s'\n" "$ltfs_mountpoint"
printf "MTX Settings\n" printf "MTX Settings\n"
printf " def changer-name: '%s'\n" "$default_changer_device" printf " def changer-name: '%s'\n" "$default_changer_device"
if [ ${#remote} -ge 1 ]; then #if [ ${#remote} -ge 1 ]; then
printf "Remote Settings\n" # printf "Remote Settings\n"
printf " remote host: '%s'\n" "$remote" # printf " remote host: '%s'\n" "$remote"
printf " ssh options: '%s'\n" "$ssh" # printf " ssh options: '%s'\n" "$ssh"
fi #fi
if [ $verbose -ge 1 ]; then tape_options="verbose_level=$verbose"; fi if [ $verbose -ge 1 ]; then tape_options="verbose_level=$verbose"; fi
if [ $dryrun -eq 1 ]; then tape_options="${tape_options} dry-run=true"; fi #if [ $dryrun -eq 1 ]; then tape_options="${tape_options} dry-run=true"; fi
if [ $color -eq 1 ]; then tape_options="${tape_options} color=true"; fi if [ $color -eq 1 ]; then tape_options="${tape_options} color=true"; fi
if [ $use_mtx -eq 1 ]; then tape_options="${tape_options} use-mtx=true"; fi if [ $use_mtx -eq 1 ]; then tape_options="${tape_options} use-mtx=true"; fi
printf "Options: '%s'\n\n" "${tape_options}" printf "Options: '%s'\n\n" "${tape_options}"
@@ -1932,10 +1932,6 @@ Options:
(input attribute: slot_source drive) (input attribute: slot_source drive)
--mount make tape accessible for OS --mount make tape accessible for OS
(input attribute: <mediapool_name> [<volume_name>]) (input attribute: <mediapool_name> [<volume_name>])
-r, --remote <host> Send the snapshot backup to a remote machine. The snapshot will be sent via ssh.
You should specify the remote machine's hostname or ip address. The 'root' user
must be permitted to login on the remote machine.
-p, --port <port> The remote port.
--update-lastwrite update LastWrite attribute for given TapeName in Pool (JSON-File) --update-lastwrite update LastWrite attribute for given TapeName in Pool (JSON-File)
(input attribute: <mediapool> <volume_name> [<YYYYMMDDHHMMSS> ) (input attribute: <mediapool> <volume_name> [<YYYYMMDDHHMMSS> )
--update-retensiondate update RetensionDate attribute for given TapeName in Pool (JSON-File) --update-retensiondate update RetensionDate attribute for given TapeName in Pool (JSON-File)
@@ -1944,10 +1940,14 @@ Options:
(input attribute: <mediapool>) (input attribute: <mediapool>)
--use-mtx use mtx loader handling. If not specified, all mtx commands will use --use-mtx use mtx loader handling. If not specified, all mtx commands will use
default device ($default_changer_device) default device ($default_changer_device)
-v, --verbose Be verbose on what's going on (min: --verbose=1, max: --verbose=3) -v, --verbose Be verbose on what's going on (min: --verbose=1, max: --verbose=3)
--version show program version --version show program version
EOF EOF
--dry-run perform a trial run where no changes are made. # -r, --remote <host> Send the snapshot backup to a remote machine. The snapshot will be sent via ssh.
# You should specify the remote machine's hostname or ip address. The 'root' user
# must be permitted to login on the remote machine.
# -p, --port <port> The remote port.
# --dry-run perform a trial run where no changes are made.
exit 0 exit 0
} }