From 5dd0dbc469e38ee5ac5c5c989237a9894a847deb Mon Sep 17 00:00:00 2001 From: "kebler.net" Date: Tue, 31 Aug 2021 11:14:15 -0700 Subject: [PATCH] add host arg --- all/dev/backup/dbackup | 9 +++------ all/dev/backup/src/root_command.sh | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/all/dev/backup/dbackup b/all/dev/backup/dbackup index 5d850ca..ac1c796 100755 --- a/all/dev/backup/dbackup +++ b/all/dev/backup/dbackup @@ -31,8 +31,6 @@ root_command() { s_server="http$([[ $s_server_secure ]] && echo "s")://${s_server_host}$([[ $s_server_port ]] && echo :${s_server_port} || echo "")" fi - - local password=${args[--password]:-$BACKUP_PASSWORD} password=${password:-$s_password} [[ ! $password ]] && echo restic requires a backup repository password, exiting && return 2 @@ -41,8 +39,8 @@ root_command() { local server=${args[--server]:-$BACKUP_SERVER} server=${server:-$s_server} - echo server $s_server - echo server $server + local host=${args[--host]:-$s_host} + if [[ $host ]]; then host="-H $host"; fi local backup_dir=${args[--backup_dir]:-$BACKUP_DIR} backup_dir=${backup_dir:-$s_backup_dir} @@ -94,14 +92,13 @@ root_command() { echo target $target echo exclude: $exclude - # local ssh="--remote-schema \"ssh -C %s /home/sysadmin/.local/bin/rdiff-backup --server\"" #cmd="$sudo rdiff-backup $options $exclude $ssh ${suser}${shost}$source ${tuser}${thost}$target" local sudo="" local pcmd="${sudo} ${password} ${bin} -r ${target}" - local cmd="${pcmd} backup ${source} ${exclude}" + local cmd="${pcmd} ${host} backup ${source} ${exclude}" if [[ ${args[--init]} ]]; then cmd="${pcmd} init"; fi if [[ ${args[--snap]} ]]; then cmd="${pcmd} snapshots"; fi diff --git a/all/dev/backup/src/root_command.sh b/all/dev/backup/src/root_command.sh index 37ef0fb..9ee6366 100644 --- a/all/dev/backup/src/root_command.sh +++ b/all/dev/backup/src/root_command.sh @@ -24,8 +24,6 @@ if [[ $s_server_host ]]; then s_server="http$([[ $s_server_secure ]] && echo "s")://${s_server_host}$([[ $s_server_port ]] && echo :${s_server_port} || echo "")" fi - - local password=${args[--password]:-$BACKUP_PASSWORD} password=${password:-$s_password} [[ ! $password ]] && echo restic requires a backup repository password, exiting && return 2 @@ -34,8 +32,8 @@ password="RESTIC_PASSWORD=${password}" local server=${args[--server]:-$BACKUP_SERVER} server=${server:-$s_server} -echo server $s_server -echo server $server +local host=${args[--host]:-$s_host} +if [[ $host ]]; then host="-H $host"; fi local backup_dir=${args[--backup_dir]:-$BACKUP_DIR} backup_dir=${backup_dir:-$s_backup_dir} @@ -87,14 +85,13 @@ echo source: $source echo target $target echo exclude: $exclude - # local ssh="--remote-schema \"ssh -C %s /home/sysadmin/.local/bin/rdiff-backup --server\"" #cmd="$sudo rdiff-backup $options $exclude $ssh ${suser}${shost}$source ${tuser}${thost}$target" local sudo="" local pcmd="${sudo} ${password} ${bin} -r ${target}" -local cmd="${pcmd} backup ${source} ${exclude}" +local cmd="${pcmd} ${host} backup ${source} ${exclude}" if [[ ${args[--init]} ]]; then cmd="${pcmd} init"; fi if [[ ${args[--snap]} ]]; then cmd="${pcmd} snapshots"; fi