add host arg

master
Kebler Network System Administrator 2021-08-31 11:14:15 -07:00
parent 2a3f2ed191
commit 5dd0dbc469
2 changed files with 6 additions and 12 deletions

View File

@ -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

View File

@ -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