fi
#expand the exclude-path for use with tar
- exf=`ssh $computer "ls ~/.backup/exclude"`
+ exf=`ssh root@$computer "ls ~/.backup/exclude"`
#We try to run tar on the remote computer
# z gzip it
# ..to dd, to output to a file. We surpress messages from dd.
# And at last, redirect stderr to stdout, to get output logged.
TARFILE=$DATE.tmp
- TARCMD="ssh $computer \"$tar --one-file-system -zcf - -C $filesystem . $lastcmd \
+ TARCMD="ssh root@$computer \"$tar --one-file-system -zcf - -C $filesystem . $lastcmd \
--exclude-from=$exf\" > $TARFILE"
echo `date`" $computer: Running $TARCMD" >&2
echo `date`" $computer: Backing up $computer" >&2
# Try to SSH to the computer without entering a password.
- if ! `ssh -n -o NumberOfPasswordPrompts=0 $computer /bin/true`; then
+ if ! `ssh -n -o NumberOfPasswordPrompts=0 root@$computer /bin/true`; then
echo `date`" $computer: Could not use passwordless SSH."
# We don't want to return 0
filesystems=""
#Sjekker nest siste felt i fstab. Om det er 0 tar vi ikke backup
- filesystems=`ssh -n $computer "cat /etc/fstab" \
+ filesystems=`ssh -n root@$computer "cat /etc/fstab" \
| grep -v nfs \
| grep -v "^#" \
| grep -v "^$" \
| awk '{ if ( $(NF-1) != "0" ) print $2}' `
#clean up our dir at this client
- if ! ssh $computer "rm -r ~/.backup ; mkdir -m 700 ~/.backup"; then
+ if ! ssh root@$computer "rm -r ~/.backup ; mkdir -m 700 ~/.backup"; then
echo `date`" $computer: Could not create backup staging area at $computer:~/.backup"
# We don't want to return 0
R=1
fi
#try to copy $exclude to $computer
- if ! scp $exclude $computer:~/.backup/exclude > /dev/null; then
+ if ! scp $exclude root@$computer:~/.backup/exclude > /dev/null; then
echo `date`" $computer: Could not copy exclude.txt to $computer"
# We don't want to return 0
R=1
#try to copy preeexec and postexec if they exist
# TODO: Gah, clean this mess!
[ -f $confdir/preexec.$computer ] && (
- scp $confdir/preexec.$computer $computer:~/.backup/preexec ||
+ scp $confdir/preexec.$computer root@$computer:~/.backup/preexec ||
( echo `date`" $computer: Could not copy preexec.$computer to $computer:~/.backup/preexec";
R=1
break
)
)
[ -f $confdir/postexec.$computer ] && (
- scp $confdir/postexec.$computer $computer:~/.backup/postexec ||
+ scp $confdir/postexec.$computer root@$computer:~/.backup/postexec ||
( echo `date`" $computer: Could not copy postexec.$computer to $computer:~/.backup/postexec"
break
R=1
)
#try to run preexec if it exist
- ssh $computer "[ -f ~/.backup/preexec ] && /bin/bash -x ~/.backup/preexec"
+ ssh root@$computer "[ -f ~/.backup/preexec ] && /bin/bash -x ~/.backup/preexec"
for filesystem in $filesystems
do
done
#try to run postexec if it exist
- ssh $computer "[ -f ~/.backup/postexec ] && /bin/bash -x ~/.backup/postexec"
+ ssh root@$computer "[ -f ~/.backup/postexec ] && /bin/bash -x ~/.backup/postexec"
)
done &