]> git.sesse.net Git - backup.sh/blobdiff - backup.sh
Deal with nice and/or ionice not existing on the target system.
[backup.sh] / backup.sh
index cfac60723c6084aa1fdff420c4a86b1028225051..71ebfe1084897fe525dd14091340d4c100a74ccb 100755 (executable)
--- a/backup.sh
+++ b/backup.sh
@@ -128,7 +128,7 @@ backup()
        #    Pipe the stuff over ssh to ourselves, run pee to cat the contents to a
        #    file and build a file list, respectivly.  
        TARFILE=$DATE.tmp
-       TARCMD="ssh -n $username@$computer \"nice -n 19 ionice -c3 tar --one-file-system --use-compress-program $compressor -cf - -C $filesystem . $lastcmd \
+       TARCMD="ssh -n $username@$computer \"$nice tar --one-file-system --use-compress-program $compressor -cf - -C $filesystem . $lastcmd \
                --exclude-from=$remotehome/.backup/exclude\" | pee \"$storageprogram > $TARFILE\" \"tar tzvf -\""
        infomsg "Running $TARCMD"
        eval $TARCMD > $DATE.idx
@@ -246,6 +246,14 @@ else
        compressor=gzip
 fi
 
+# Check if nice and ionice are available
+if ssh -n $username@$computer "nice -n 19 ionice -c3 /bin/true 2>/dev/null"; then
+       nice="nice -n 19 ionice -c3"
+else
+       infomsg "nice and/or ionice missing; will run at normal priority."
+       nice=""
+fi
+
 # Check dump bit in fstab
 filesystems=`ssh -n $username@$computer "cat /etc/fstab" \
        | grep -v nfs \
@@ -327,7 +335,7 @@ for filesystem in $filesystems; do
 
        # Check if this box has a custom number of full backups
        if [ -f $confdir/maksfulle.$computer.$sfilesystem ]; then
-               mf=$((`cat $confdir/maksfulle.$computer`+1))
+               mf=$((`cat $confdir/maksfulle.$computer.$sfilesystem`+1))
        elif [ -f $confdir/maksfulle.$computer ] ; then
                mf=$((`cat $confdir/maksfulle.$computer`+1))
        else