Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: Lee on January 15, 2013, 05:17:27 PM

Title: Minor change request for filetool.sh
Post by: Lee on January 15, 2013, 05:17:27 PM
I have a line in my conky config that reports on the size, file count and date stamp of mydata.tgz.

Of course, I don't want to open up the tar file once every second so I originally set it up to just check the stats once right before conky starts up.

Being clever, I thought I would modify filetool.sh to write a flag file to /tmp whenever it finishes a backup and then have conky check the file date and process accordingly.  Upon opening up filetool.sh with my trusty editor, I found this task greatly simplified by the fact that such a flag file is already created.  How convenient!  :)

However, I notice that /tmp/backup_done is -not- created in the VERBOSE section.  Is there some reason for this, or perhaps just an oversight?

filetool.sh actually already does what I need, since I don't use the VERBOSE option, but it seems like it ought to be consistent (unless that would break something else).

Below is the code section in question with the suggested line copied up from the non-VERBOSE section (the commented line):
Code: [Select]
  if [ "$VERBOSE" ]; then
    sudo tar -C / -T /opt/.filetool.lst -X /opt/.xfiletool.lst  -czvf $MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz
#   touch /tmp/backup_done
    [ "$PROMPT" ] && echo -n "Press enter to continue:" &&  read ans
  else
    echo -n "Backing up files to $MOUNTPOINT/$FULLPATH/${MYDATA}.tgz"
    [ -f /tmp/backup_status ] && sudo rm -f /tmp/backup_status
    sudo tar -C / -T /opt/.filetool.lst -X /opt/.xfiletool.lst  -czf "$MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz"  2>/tmp/backup_status $
    rotdash $!
    sync
    [ -s /tmp/backup_status ] && sed -i '/socket ignored/d' /tmp/backup_status 2>/dev/null
    [ -s /tmp/backup_status ] && exit 1
    touch /tmp/backup_done
  fi
Title: Re: Minor change request for filetool.sh
Post by: Rich on January 15, 2013, 05:28:06 PM
Hi Lee
No need to duplicate the  touch  statement. Just move the original one down so it's after the  fi  statement.
Title: Re: Minor change request for filetool.sh
Post by: Lee on January 15, 2013, 09:10:34 PM
Right - that's the cleaner way.

Darn!  You'd think I never did this stuff for a living.