Script makes dated backup files
jrb,
I do not know if this would help and it is designed so as to have the backed up pupsave name in the format of "pupsave-520.sfs.BAK.yy.mm.dd.hh.mm"
But I am sure you could adjust it as needed.
I also leave it up to you to change the line that I have an example backed up pupsave name in.
Maybe use =%1.
But here is a short script for you to try.
It will take a supplied name and remove all the BAK-date-time stuff and leave you with a clean pupsave file name that can be copied back in on a restore.
Given a little time, I could write a restore script for restoring from a saved backup of pupsave-xxx.2fs.
I do not know if this would help and it is designed so as to have the backed up pupsave name in the format of "pupsave-520.sfs.BAK.yy.mm.dd.hh.mm"
But I am sure you could adjust it as needed.
I also leave it up to you to change the line that I have an example backed up pupsave name in.
Maybe use =%1.
But here is a short script for you to try.
Code: Select all
#! /bin/bash
PSNAME='pupsave-500-23.2fs.BAK-11.20.02.12.30'
newname=`echo $PSNAME | sed "s/...................$//"` #That is 19 periods there.
echo PSNAME = $PSNAME
echo newname = $newname
Given a little time, I could write a restore script for restoring from a saved backup of pupsave-xxx.2fs.
Thanks 8-bit.
That explains it then. One rename it before restore.
TinyCore has a back up and restore function that is already built in.
So would be interesting to get how them do that feature
What about this .2fs and .3s some puppies one have .2fs and for some one have .3fs out of habit or curiosity. Would one need two different such scripts then?
That explains it then. One rename it before restore.
TinyCore has a back up and restore function that is already built in.
So would be interesting to get how them do that feature
What about this .2fs and .3s some puppies one have .2fs and for some one have .3fs out of habit or curiosity. Would one need two different such scripts then?
I use Google Search on Puppy Forum
not an ideal solution though
not an ideal solution though
nooby, if you copy the short script into geany, save it and nake it executable, you can edit the line in geany that defines PSNAME.
Put any pupsave name and type in there replacing the "pupsave-500-23.2fs" with any name you want to try it with such as warysave-2000.3fs or noobysave-01.4fs.
It will still work fine.
The only thing here is that it expects the pupsave backup name to be in a given format.
If the 2fs or 3fs extension is at the end of the name with the date-time stamp in the middle, then you have to change the way it is parsed to get a resulting name without the time-date stamp.
With a little effort, a GUI could be made that supports drag and drop for input of the filename.
Put any pupsave name and type in there replacing the "pupsave-500-23.2fs" with any name you want to try it with such as warysave-2000.3fs or noobysave-01.4fs.
It will still work fine.
The only thing here is that it expects the pupsave backup name to be in a given format.
If the 2fs or 3fs extension is at the end of the name with the date-time stamp in the middle, then you have to change the way it is parsed to get a resulting name without the time-date stamp.
With a little effort, a GUI could be made that supports drag and drop for input of the filename.
Thanks Flash, I'll check out /etc/rc.shutdown and see if I can figure out how Barry does it.Flash wrote:Multisession Puppy creates dated session names. Each session it saves on the DVD is named with the date and time it was created. How the Save script does that I have no idea. I just thought you might find it interesting to compare it to your way.
jrb,
My main problem is not knowing the pupsave name the user gives his save file.
That complicates knowing what to look for in removing the date-time part of the filename.
But if this will help you any at all, you can check this code for the format you use. It is very rough and you need to run it from a terminal to see that it does indeed remove the date-time from the filename.
But I am not sure of how to look for an unknown end of the initial filename before the date-time is added. Maybe I can use the dash.
Will get back to you.
EDITED: Dash works and also deleted dash
My main problem is not knowing the pupsave name the user gives his save file.
That complicates knowing what to look for in removing the date-time part of the filename.
But if this will help you any at all, you can check this code for the format you use. It is very rough and you need to run it from a terminal to see that it does indeed remove the date-time from the filename.
But I am not sure of how to look for an unknown end of the initial filename before the date-time is added. Maybe I can use the dash.
Will get back to you.
EDITED: Dash works and also deleted dash
Code: Select all
#! /bin/bash
PSNAME='warysaveA-11-09-22_10.13.3fs'
newname=`echo $PSNAME | sed 's/-.*.3fs/-.3fs/' | sed 's/-//'`
echo PSNAME = $PSNAME
echo newname = $newname
pschedule to backup a pupsave file
I describe how to use pschedule to backup a pupsave file
http://www.murga-linux.com/puppy/viewto ... 279#567279
I made only a slight change to your script to do the
rename and copy.
____________________________________________________--
http://www.murga-linux.com/puppy/viewto ... 279#567279
I made only a slight change to your script to do the
rename and copy.
____________________________________________________--
Re: pschedule to backup a pupsave file
Excellent, saves me the bother of having to work out a GUI.don570 wrote:I describe how to use pschedule to backup a pupsave file
I made only a slight change to your script to do the
rename and copy.
I worked on this last night and came up with a solution which works nicely on pupsave files but may have difficulties with a few other filenames (if they have "save" in the name). Will try to get back to it soon and post script. (Seem to have misplaced the work I did , maybe I just dreamed it?) Will duplicate soon.jrb wrote:I just realized that a backup of a file previously backed up gives the date and time of both backups, i.e. warysave-11-09-11_12.30-11-09-22_15.25.3fs
Cheers, J
I also have been playing expanding on don570's work and trying to set up a Restore script.
One would have to have booted with pfix=ram and be in the frugal directory for the restore of the backed up pupsave.
If you are brave, you can remove the last 4 comment markers in the script and comment out the hardwired PSNAME and uncomment the line below it to try it. Naturally comment markers are "#".
I did this so no one would get problems if they just ran it as is.
One would have to have booted with pfix=ram and be in the frugal directory for the restore of the backed up pupsave.
If you are brave, you can remove the last 4 comment markers in the script and comment out the hardwired PSNAME and uncomment the line below it to try it. Naturally comment markers are "#".
I did this so no one would get problems if they just ran it as is.
Code: Select all
#! /bin/bash
PSNAME='warysaveA-11-09-22_10.13.4fs'
#PSNAME=$@
FNAME=`basename $PSNAME`
DIR=`dirname $PSNAME`
EXT1=${FNAME##*.}
#if file has no extension must use the following:
if [ $FNAME = $EXT1 ]
then
EXT2=""
else
EXT2=.$EXT1
fi
if [ $EXT2 = ".3fs" ]
then
newname=`echo $PSNAME | sed 's/-.*.3fs/-.3fs/' | sed 's/-//'`
fi
if [ $EXT2 = ".2fs" ]
then
newname=`echo $PSNAME | sed 's/-.*.2fs/-.2fs/' | sed 's/-//'`
fi
if [ $EXT2 = ".4fs" ]
then
newname=`echo $PSNAME | sed 's/-.*.4fs/-.4fs/' | sed 's/-//'`
fi
#cd $DIR
#cp -r $DIR/$PSNAME $DIR/$newname
#sync
#xmessage "Restore completed"
echo PSNAME = $PSNAME
echo newname = $newname
echo EXT2 = $EXT2
echo Directory = $DIR
I just uploaded dated_backup-0.2.pet in the first post.
This one deletes out previous times and dates in "save" files and places in the latest date. It also deletes anything else after the word "save" in anyfile its used on but I can live with that.
I have also placed it on the rox right click menu for .2fs, .3fs, .4fs, scripts and plain text. For all other files it is still on the OpenWith menu.
Barring any unforeseen catastrophes I think I'm finished with this. Anyone who wishes to use the code or make improvements - go for it.
Cheers, J
This one deletes out previous times and dates in "save" files and places in the latest date. It also deletes anything else after the word "save" in anyfile its used on but I can live with that.
I have also placed it on the rox right click menu for .2fs, .3fs, .4fs, scripts and plain text. For all other files it is still on the OpenWith menu.
Barring any unforeseen catastrophes I think I'm finished with this. Anyone who wishes to use the code or make improvements - go for it.
Cheers, J