From 948635d7a45badaf24b8e66c54e92073234dab23 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 15 Oct 2016 10:46:42 +0200 Subject: [PATCH] Deal with nice and/or ionice not existing on the target system. --- backup.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backup.sh b/backup.sh index 4ae63a3..71ebfe1 100755 --- 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 \ -- 2.39.2