diff --git a/all/dev/backup/dbackup b/all/dev/backup/dbackup index edd5141..5d850ca 100755 --- a/all/dev/backup/dbackup +++ b/all/dev/backup/dbackup @@ -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 diff --git a/all/dev/backup/src/root_command.sh b/all/dev/backup/src/root_command.sh index 7590110..37ef0fb 100644 --- a/all/dev/backup/src/root_command.sh +++ b/all/dev/backup/src/root_command.sh @@ -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