Linux Script to restore savefile <Solved>
Linux Script to restore savefile <Solved>
Hi,
I installed 2 flavour of Puppy Linux on a laptop (frugal install).
I made backup of the savefiles in another partition/dir. I already tested restoring them manually thru GUI (file manager). That is I restore savefile1, by selecting/running flavour-2 on GRUB4DOS menu, and do the restore. And vice versa.
Before I hand the laptop to a family member for use, I would like to create an icon (file) on desktop, sort of a script to restore should something happen. This script would help as they live 2 hours away (return trip)..
I'm not familiar with linux script, or at the most 'very rusty' and would take me ages. And a linux script person would be able to this in minutes..
I'd like the script to open a window/terminal and runs following commands
wait "Hit a key to continue"
rm /installdir/currentsavefile
cp /backupdir/savefile /installdir/currentsavefile
wait "Hit a key to continue"
How do I go about doing this please?
Thanks.
I installed 2 flavour of Puppy Linux on a laptop (frugal install).
I made backup of the savefiles in another partition/dir. I already tested restoring them manually thru GUI (file manager). That is I restore savefile1, by selecting/running flavour-2 on GRUB4DOS menu, and do the restore. And vice versa.
Before I hand the laptop to a family member for use, I would like to create an icon (file) on desktop, sort of a script to restore should something happen. This script would help as they live 2 hours away (return trip)..
I'm not familiar with linux script, or at the most 'very rusty' and would take me ages. And a linux script person would be able to this in minutes..
I'd like the script to open a window/terminal and runs following commands
wait "Hit a key to continue"
rm /installdir/currentsavefile
cp /backupdir/savefile /installdir/currentsavefile
wait "Hit a key to continue"
How do I go about doing this please?
Thanks.
Last edited by dcung on Thu 02 Aug 2018, 08:21, edited 1 time in total.
here is something you can save somewhere and drag a link to the desktop as a shortcut. I put it in /root/my-applications/restore-savefile make it executable and using rox-filer drag an it as icon to the desktop.
Code: Select all
#!/bin/sh
gxmessage 'Do you want to Restore savefile?' \
-buttons 'Cancel:1,Restore:2,Reboot:3,Shut Down:4' \
-center
case $? in
2)
rm /root/spot/testsavefile.txt
cp /root/ftpd/testsavefile.txt /root/spot/testsavefile.txt
gxmessage 'Savefile Restored' -center -timeout 4
;;
3)
reboot
;;
4)
poweroff
;;
esac
Thanks rockedge.!
That's what I need.
Tested and working!
In UpupBB, it presented popup.
No biggies, just another click. I'm sure they can handle that.
But if there's a way to bypass, that's even better.
That's what I need.
Tested and working!
In UpupBB, it presented popup.
No biggies, just another click. I'm sure they can handle that.
But if there's a way to bypass, that's even better.
- Attachments
-
- Screenshot.png
- (11.09 KiB) Downloaded 220 times
This looks like you are running a LxPup or even a file manager like PCManFM. I'm not sure, though I think you can't bypass/skip this GUI.
Except: you wold create a .desktop file for it in /usr/share/applications and starting the script via this .desktop file (from menu or placed at the Desktop if possible).
Except: you wold create a .desktop file for it in /usr/share/applications and starting the script via this .desktop file (from menu or placed at the Desktop if possible).
Backup Savefile and/or Pup partition
G'day dcung,
In case you want to try existing packages to save your Pups from family-tinkering, you could check packages in the 'Utilities' Menu. The screenshot shows these on one of my BionicPups as pinboard icons and as Menu items (if you can read the jpg text).
There is a savefile back-up - for regular backups of just one Pup's savefile (not the read-only fixed Puppy OS files). Or before trying anything 'risky' - if you know it's risky before you do it - that can wreck your savefile.
And a Puppy backup to mirror the Puppy partition, for when you have numerous Pups on a partition, or for your data partition(s) holding your important personal data, etc.
David S..
In case you want to try existing packages to save your Pups from family-tinkering, you could check packages in the 'Utilities' Menu. The screenshot shows these on one of my BionicPups as pinboard icons and as Menu items (if you can read the jpg text).
There is a savefile back-up - for regular backups of just one Pup's savefile (not the read-only fixed Puppy OS files). Or before trying anything 'risky' - if you know it's risky before you do it - that can wreck your savefile.
And a Puppy backup to mirror the Puppy partition, for when you have numerous Pups on a partition, or for your data partition(s) holding your important personal data, etc.
David S..
- Attachments
-
- savepup-options-bionic.jpg
- pinboard icons and Menu listed options
- (154.57 KiB) Downloaded 213 times
Re: Backup Savefile and/or Pup partition
Thanks for the tips David.davids45 wrote:There is a savefile back-up - for regular backups of just one Pup's savefile (not the read-only fixed Puppy OS files). Or before trying anything 'risky' - if you know it's risky before you do it - that can wreck your savefile.
I'll keep that in mind when I'm tinkering, this will fit my need.
For my relative need, the codes from rockedge suited well for the purpose.
Just want to eliminate the extra 'click' if possible...
Just download the attached file, remove the fake .gz suffix and store it at /usr/share/applications. From that location drag and drop it onto the desktop.Just want to eliminate the extra 'click' if possible
Now it should bypass that extra GUI when clicked.
- Attachments
-
- rockedge-restore-savefile.desktop.gz
- (281 Bytes) Downloaded 71 times
(Off-topic) Muppy-Filer in Bionics
G'day,
First apologies to dcung for going a little bit off-topic in his <Solved> thread , but this is a reply for RSH re his posted question about my screenshot from a Bionic Pup in my above post.
I re-booted this morning into another BionicPup (peebee breeds them so quickly it's hard to keep track!) and Muppy-Filer and Sfs-Combiner do run in these 32-bit Bionics as far as I can determine (screenshot).
The little arrow at the top-corner of the pinboard icon tells me Muppy-Filer is running as an sfs-ed link from this Bionic Pup on sda1 back to the actual Muppy-Filer package on my sda5 data partition. The same for SFS-Combiner. The same 'install' set-up as my earlier Bionic screenshot as both Bionic Pups would be using the same sfs on sda1.
I cannot recall any previous problem with Muppy-Filer not running in any Puppy (Slackos, Stretches, or Ubuntu-influenced).
David S.
First apologies to dcung for going a little bit off-topic in his <Solved> thread , but this is a reply for RSH re his posted question about my screenshot from a Bionic Pup in my above post.
I re-booted this morning into another BionicPup (peebee breeds them so quickly it's hard to keep track!) and Muppy-Filer and Sfs-Combiner do run in these 32-bit Bionics as far as I can determine (screenshot).
The little arrow at the top-corner of the pinboard icon tells me Muppy-Filer is running as an sfs-ed link from this Bionic Pup on sda1 back to the actual Muppy-Filer package on my sda5 data partition. The same for SFS-Combiner. The same 'install' set-up as my earlier Bionic screenshot as both Bionic Pups would be using the same sfs on sda1.
I cannot recall any previous problem with Muppy-Filer not running in any Puppy (Slackos, Stretches, or Ubuntu-influenced).
David S.
- Attachments
-
- MuppyFiler-in-Bionic.jpg
- (120.4 KiB) Downloaded 149 times
Muppy Filer
G'day dcung,
Muppy Filer is a file manager written, now many years ago, by an early Puppy programming expert, Mark Ulrich.
He wrote it to suit his regular programming needs in Puppy so has many functions related to writing as well as using Puppy files.
It has two panels (so not quite as good as Rox with its as-many-as-you-like windows/panels).
Muppy-Filer has numerous Puppy-related buttons to work on/with files in either panel (screenshot).
I like it particularly to navigate to a directory/file by clicking in a panel, then click on a button , e.g. 'shell' to immediately open a terminal at that location - no typing necessary, unlike using just the terminal to move to a particular file.
Muppy-Filer is over ten years old so won't work in 64-bit Pups .
It also requires two other packages, PuppyBasic and GtkBasic.
The Puppy-Basic pet is as small as Muppy-Filer.pet but the GtkBasic pet is too big for me to attach to the forum (screenshot).
These three files may be available on one of the Puppy repositories held/maintained by some forum members but I don't know for sure. Maybe one of these, if they have the three Muppy-Filer files available, could reply?
There may be other file managers that will do the same things as Muppy-Filer, but it's the program I'm now very used to, so I haven't looked elsewhere.
David S.
Muppy Filer is a file manager written, now many years ago, by an early Puppy programming expert, Mark Ulrich.
He wrote it to suit his regular programming needs in Puppy so has many functions related to writing as well as using Puppy files.
It has two panels (so not quite as good as Rox with its as-many-as-you-like windows/panels).
Muppy-Filer has numerous Puppy-related buttons to work on/with files in either panel (screenshot).
I like it particularly to navigate to a directory/file by clicking in a panel, then click on a button , e.g. 'shell' to immediately open a terminal at that location - no typing necessary, unlike using just the terminal to move to a particular file.
Muppy-Filer is over ten years old so won't work in 64-bit Pups .
It also requires two other packages, PuppyBasic and GtkBasic.
The Puppy-Basic pet is as small as Muppy-Filer.pet but the GtkBasic pet is too big for me to attach to the forum (screenshot).
These three files may be available on one of the Puppy repositories held/maintained by some forum members but I don't know for sure. Maybe one of these, if they have the three Muppy-Filer files available, could reply?
There may be other file managers that will do the same things as Muppy-Filer, but it's the program I'm now very used to, so I haven't looked elsewhere.
David S.
- Attachments
-
- Muppy-Filer-panels.jpg
- (88.37 KiB) Downloaded 93 times
-
- Files-for-Muppy-Filer.jpg
- (47.96 KiB) Downloaded 92 times
- perdido
- Posts: 1528
- Joined: Mon 09 Dec 2013, 16:29
- Location: ¿Altair IV , Just north of Eeyore Junction.?
Some internet links for the packages davids45 referenced.
Muppy-Filer (August, 31, 2008)
GtkBasic003e.pet
PuppyBasic-2.6.pet
Muppy-Filer-0.2.pet
.
Muppy-Filer (August, 31, 2008)
GtkBasic003e.pet
PuppyBasic-2.6.pet
Muppy-Filer-0.2.pet
.