make sudo optional, set a prefix command common to all
parent
b6e3f1bb2b
commit
2a3f2ed191
|
@ -98,19 +98,20 @@ root_command() {
|
|||
# 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}"
|
||||
|
||||
cmd="sudo $password $bin -r $target backup $source $exclude"
|
||||
|
||||
if [[ ${args[--init]} ]]; then cmd="sudo $password $bin -r $target init"; fi
|
||||
if [[ ${args[--snap]} ]]; then cmd="sudo $password $bin -r $target snapshots"; fi
|
||||
if [[ ${args[--prune]} ]]; then cmd="sudo password $bin -r $target prune"; fi
|
||||
if [[ ${args[--init]} ]]; then cmd="${pcmd} init"; fi
|
||||
if [[ ${args[--snap]} ]]; then cmd="${pcmd} snapshots"; fi
|
||||
if [[ ${args[--prune]} ]]; then cmd="${pcmd} prune"; fi
|
||||
if [[ ${args[--view]} || ${args[--view-path]} ]]; then
|
||||
mount=${args[--view-path]:-$BACKUP_MOUNT}
|
||||
mount=${mount:-"/opt/backup/view/"}
|
||||
echo view mount point $mount
|
||||
if [[ -e ${mount} ]]; then
|
||||
cmd="$password $bin -r $target mount $mount";
|
||||
cmd="${pcmd} mount $mount";
|
||||
echo browse files at $mount/snapshots/latest${source}
|
||||
else
|
||||
echo $mount: directory for mounting snapshot for viewing does not exist. Create and try again
|
||||
|
|
|
@ -91,19 +91,20 @@ 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}"
|
||||
|
||||
cmd="sudo $password $bin -r $target backup $source $exclude"
|
||||
|
||||
if [[ ${args[--init]} ]]; then cmd="sudo $password $bin -r $target init"; fi
|
||||
if [[ ${args[--snap]} ]]; then cmd="sudo $password $bin -r $target snapshots"; fi
|
||||
if [[ ${args[--prune]} ]]; then cmd="sudo password $bin -r $target prune"; fi
|
||||
if [[ ${args[--init]} ]]; then cmd="${pcmd} init"; fi
|
||||
if [[ ${args[--snap]} ]]; then cmd="${pcmd} snapshots"; fi
|
||||
if [[ ${args[--prune]} ]]; then cmd="${pcmd} prune"; fi
|
||||
if [[ ${args[--view]} || ${args[--view-path]} ]]; then
|
||||
mount=${args[--view-path]:-$BACKUP_MOUNT}
|
||||
mount=${mount:-"/opt/backup/view/"}
|
||||
echo view mount point $mount
|
||||
if [[ -e ${mount} ]]; then
|
||||
cmd="$password $bin -r $target mount $mount";
|
||||
cmd="${pcmd} mount $mount";
|
||||
echo browse files at $mount/snapshots/latest${source}
|
||||
else
|
||||
echo $mount: directory for mounting snapshot for viewing does not exist. Create and try again
|
||||
|
|
Reference in New Issue