+# Check that the target filesystem is mounted (actually check that it's not
+# the root filesystem)
+if [ ! -d "$storagedir/$computer" ]; then
+ echo `date`" $computer: Target filesystem ($storagedir/$computer) does not exist. Aborting"
+ die
+fi
+rootfilesystem=`df -P /`
+targetfilesystem=`df -P "$storagedir/$computer"`
+if [ "$rootfilesystem" == "$targetfilesystem" ]; then
+ echo `date`" $computer: Target filesystem ($storagedir/$computer) was mounted on /. Aborting"
+ die
+fi
+
+echo `date`" $computer: Backing up $computer" >&2
+
+# Try to SSH to the computer without entering a password.
+if ! `ssh -n -o NumberOfPasswordPrompts=0 root@$computer /bin/true`; then
+ echo `date`" $computer: Could not use passwordless SSH."
+ die
+fi
+
+# Check if pigz is available
+if ssh -n root@$computer "pigz -V 2>/dev/null"; then
+ compressor=pigz
+else
+ echo `date`" $computer: pigz missing; falling back to gzip."
+ compressor=gzip
+fi
+
+# Check dump bit in 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 root@$computer "rm -r ~/.backup ; mkdir -m 700 ~/.backup"; then
+ echo `date`" $computer: Could not create backup staging area at $computer:~/.backup"
+ die
+fi
+
+# Try to copy $exclude to $computer
+if ! scp $exclude root@$computer:~/.backup/exclude > /dev/null; then
+ echo `date`" $computer: Could not copy exclude.txt to $computer"
+ die
+fi
+
+# Try to copy preeexec and postexec if they exist
+if [ -f $confdir/preexec.$computer ]; then
+ if ! scp $confdir/preexec.$computer root@$computer:~/.backup/preexec >&2; then
+ echo `date`" $computer: Could not copy preexec.$computer to $computer:~/.backup/preexec"
+ die
+ fi
+fi
+if [ -f $confdir/postexec.$computer ]; then
+ if ! scp $confdir/postexec.$computer root@$computer:~/.backup/postexec >&2; then
+ echo `date`" $computer: Could not copy postexec.$computer to $computer:~/.backup/postexec"
+ die
+ fi
+fi
+
+# Try to run preexec if it exists
+if ! ssh root@$computer "[ ! -f ~/.backup/preexec ] || /bin/bash -x ~/.backup/preexec" >&2; then
+ echo `date`" $computer: Could not run $computer:~/.backup/preexec"
+ die
+fi
+
+for filesystem in $filesystems