WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: filetool.sh process  (Read 1856 times)

Offline onelife

  • Full Member
  • ***
  • Posts: 141
filetool.sh process
« on: July 19, 2015, 02:23:54 AM »
Greetings Forum,

I have previously posted a similar message on this topic but when trying to post a reply in the old thread, it suggested I start a new. So here it is again.

I'm looking for any help on manually updating the filetool.sh script / process to simply swap the process of copying "mydata.tgz" > "mydatabk.tgz only AFTER successfully creating a new mydata.tgz.

IOW, at the moment there is a window of concern during the process of creating the new mydata.tgz. On my system this backup takes say 15-20 seconds or more. During this time, should the power to the unit be removed (Thanks to our poor electricity supply here in SA and Africa), the system is now "dead" without a working "mydata.tgz" as the process would have been interrupted + the previous mydata.tgz would have been renamed already.

Thus, is there anyway someone can think of insuring the new "mydata.tgz" file is only named accordingly once it's been backup up 100%. IOW, at the end of the process only then replace "mydata.tgz" and do the rename. This hopefully making the window of concern much smaller.

I have enough space on the system for a 3rd backup if need be, but it's finding a way to tweak the filetool.sh process to do this OR find a way to make sure the system will boot with the "mydatabk.tgz" file if the "mydata.tgz" is not correct or wasn't completed fully.

As a thought, maybe part of the filetool.sh process could be to set a "flag" on another partition of the SD card that is in the "data store" as such. IOW, a file that isn't effected by RAM and doesn't need backing up. So on a "normal filesystem" partition. This file say "backup_completed" would be deleted /renamed as the first step of the filetool.sh process and then put back / renamed as the last step of the filetool.sh process. Then on boot, the system would simply look for this file, if NOT found, it would then use the "mydatabk.tgz" file and not the partially created "mydata.tgz" file. Just a thought?

Any ideas will help with this and suggestions on how I can perhaps implement this :)

BIG Thanks

Regards
Dean

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11179
Re: filetool.sh process
« Reply #1 on: July 19, 2015, 08:11:58 AM »
Hi onelife
The simplest fix I can think of for your situation is to just copy  mydata.tgz  to  mydata.tgz.old  prior to running each backup.
If you get a power interruption, copy  mydata.tgz.old  to  mydata.tgz.  That way you'll always have a restore point.