WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Minor change request for filetool.sh  (Read 1884 times)

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Minor change request for filetool.sh
« 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
32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11515
Re: Minor change request for filetool.sh
« Reply #1 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.

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Re: Minor change request for filetool.sh
« Reply #2 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.
32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar