Shutdown without updating savefile. Alternative method

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

Shutdown without updating savefile. Alternative method

#1 Post by greengeek »

Do you want to be able to shut down your usb puppy quickly? Without waiting for the final savefile update which can often take several minutes if you have a slow usb stick or lots of data waiting to be updated?

Puppy usb installs are usually set with the default setting to save all data to the savefile periodically, and that can be a useful function so that you capture whatever work you have been saving into Puppy's internal file structure. However, I don't always want to allow the final pupsave that occurs during the powerdown sequence. Sometimes I just want to shutdown quickly with a single click. no questions asked.

This might be because I am in a hurry and don't care about any new data I've just been viewing/downloading, or it might be that I am choosing to discard changes that I have just made (eg: I might have accidentally removed a critical folder and I don't want that deletion to become permanent)

I want to highlight two methods that can be used to achieve this:

1) There is a superquick way to shut down your usb puppy.
***WARNING*** This method is potentially dangerous, and there may be significant risk to your data.***WARNING***
If you want to take this risk (and sometimes I do...) the topic is here:
http://www.murga-linux.com/puppy/viewtopic.php?t=67084

(also another similar discussion here: )
http://www.murga-linux.com/puppy/viewtopic.php?t=89282


2) I also have another method which does NOT bypass the normal "soft" shudown procedures, it just bypasses the final pupsave procedure. You don't have to go through the normal shutdown menu, you just click a desktop icon which forces an immediate shutdown without save, but with all the normal unmounts etc. It can save you several minutes of valuable time.
Here is how to do it:
a) First we need to modify the shutdown file so that it is ready to wait for our "no_save" command:

Locate file /etc/rc.d/rc.shutdown and open it as text.
Search for "13)" and/or "snapmergepuppy" and find the paragraph that looks like the code snippet below:
Add in 3 extra lines as shown embedded here:

Code: Select all

13) #PDEV1 and PUPSFS and PUPSAVE
  #/initrd/pup_rw has tmpfs, pup_ro1 has ${DISTRO_FILE_PREFIX}save.2fs file (PUPSAVE), pup_ro2 has PUPSFS file.
  #the above are in unionfs at /.
  #Start "if" test for "No_save" flag file and save only "if" file "/tmp/No_save" does actually exist
  if [ ! -f "/tmp/No_save" ];then
  echo "`eval_gettext \"Saving session to \\\${SAVEFILE} (\\\${SAVEPART})...\"`" >/dev/console
  #echo "Saving session to $SAVEFILE (${SAVEPART})..." >/dev/console
  /usr/sbin/snapmergepuppy /initrd/pup_ro1 /initrd/pup_rw
  fi #end "if" test.
  ;;
(Thanks 01micko for the "if" code - I couldn't have done it without that...)

b) Write a script containing the following code and put it into /usr/bin

Code: Select all

#!/bin/sh
echo "test" > /tmp/No_save
/usr/bin/wmpoweroff
(This script will create a temporary "flag file" which will tell the shutdown procedure NOT to save. We will call this script from a new desktop icon. I called my script "No_save" but any name without spaces is fine)

c) Drag this script onto the desktop (creates a symlink). Right click it and add an icon if you wish. (I have attached a super high quality one if you are desperate)

*******IMPORTANT NOTE*******
You must now force (or wait for...) a "save to savefile" to occur, otherwise these changes will not be retained.
In other words - don't trial the new icon until after everything is saved into your savefile, or else all you will do is shutdown without saving the changes!

.
Attachments
nosave48.png
Free, high quality icon
(4.3 KiB) Downloaded 4332 times
save no_save desktop_.png
Save or don't save - your choice
(16.4 KiB) Downloaded 4301 times
Last edited by greengeek on Mon 14 Oct 2013, 05:07, edited 1 time in total.

Pelo

alternate method : pet pupsavconfig

#2 Post by Pelo »

http://www.murga-linux.com/puppy/viewto ... 80&t=78055

Same process as for the first use of the distro .

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#3 Post by greengeek »

Thanks Pelo. Does pupsaveconfig allow you to place an icon on the desktop to shutdown immediately without saving? I looked at that forum post but my french is not good I m afraid.

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#4 Post by dejan555 »

I think your first post just answered my question, this Nosave flag is what I need I think
http://murga-linux.com/puppy/viewtopic. ... 536#670536

EDIT: Nope, please ignore I see you modified rc.shutdown for that flag file my bad for skimming through thread
Last edited by dejan555 on Tue 11 Dec 2012, 18:13, edited 1 time in total.
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#5 Post by Sylvander »

What if the user wants to REBOOT without saving the session changes? :wink:

Oops...
You made the following post during my edit. :oops:

e.g. I often want to make no session saves during the session...
Then reboot into a new session without saving during the reboot.

This would typically be a banking or buying session...
Or opening multiple unusual web-pages that I don't want to save...
Then reboot into a normal session->[open at the Puppy Forums plus the PC-Guide Forums]...
During and after which I would probably again save no changes, but then again I might.
Last edited by Sylvander on Tue 11 Dec 2012, 18:15, edited 2 times in total.

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#6 Post by dejan555 »

then use wmreboot in script instead wmpoweroff :)
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#7 Post by Sylvander »

With my present arrangement...
I can choose to either shutdown or reboot...
And THEN I'm asked whether "to save or not to save"...
"Don't save" is the default, and that's my usual choice [I just hit "Enter" to "OK" that].

Is there any way with the above method to choose the one or the other?
i.e.
REBOOT and don't save...
Or...
SHUTDOWN and don't save.

I imagine the user should make 2 shortcuts:
1 with its script using wmreboot...
The other with its script using wmpoweroff.

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#8 Post by dejan555 »

Yes, there are ways to do it with one script and simple dialog box where you would have just shutdown and reboot buttons and wouldn't save session, or you could just write script to write the No_save file and then shutdown or reboot from normal menu, wmpoweroff/wmreboot is really not needed in script but then you need to click the script to make file and then regularly use menu's shutdown/reboot
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#9 Post by greengeek »

Sylvander wrote:e.g. I often want to make no session saves during the session...
Then reboot into a new session without saving during the reboot.
So possibly what you want is an icon which basically could be called "Temporarily suspend savefile updates and then do not save at shutdown"?

Or maybe two icons:
1) "Temporarily suspend savefile updates"
2) "Shutdown without saving" (like my icon)

I will give this some thought.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#10 Post by greengeek »

Hi dejan, when I first started looking at how to alter savefile behaviour during shutdown I realised that there are other files in the loop aswell - one of which looks at whether or not the savefile already exists (and if not it asks to create one). Maybe there will be some reminder for you in this post:
http://murga-linux.com/puppy/viewtopic. ... 8&start=36
Maybe it was one of those other files you originally modified?

Maybe a search for "snapmergepuppy" in the rc.shutdown file will help you spot which part of the dialog looks for a savefile? I will try to find something later tonight.

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#11 Post by dejan555 »

I'm looking at /usr/sbin/shutownconfig now it seems Barry moved some code from rc.shutdown there, the puppy version I remastered for my desk before is older so the scripts changed a lot I guess. Haven't done much scripting or modifyng for a while so I need some time to catch on things :)
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#12 Post by RSH »

A picture is telling more than a thousand words. :D

Already done in LazY Puppy 2!
Attachments
image-1.jpg
(29.54 KiB) Downloaded 4124 times
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#13 Post by Sylvander »

greengeek wrote:Or maybe two icons:
1) "Temporarily suspend savefile updates"
2) "Shutdown without saving" (like my icon)
A. My present arrangement:
1. My pupsave on a partition on an internal HDD is treated as though it's a pupsave on a Flash Drive.
To do this I edit one of the settings in a file in the Puppy ISO.
Then...
2. I set the save interval to zero [0], so that there is no auto-save during the session.
3. If I want to save during the session, I click the "Save" icon on the desktop.
SO...
I think what you need is...

B. Three icons:
1. An icon to set the save interval to zero on 1st click...
Click once more and the save interval goes back to the default 30 min.
Does your "Temporarily suspend savefile updates" do [something like] this?

2. An icon to "Shutdown without saving".

3. An icon to "Reboot without saving".

--------------------------------------------------------------------------------------------------------

C. Oops, RSH got in with that post whilst I was typing my own response.
I don't have Lazy Puppy in my stack of 7 Puppy Cd's.
I believe I tried your version 2.0.2 [17th June 2012][still have that ISO] and found it wouldn't boot on my 2012 64-bit desktop PC
[Asrock H61M-S mobo].

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#14 Post by greengeek »

Sylvander wrote:1. An icon to set the save interval to zero on 1st click...
Click once more and the save interval goes back to the default 30 min.
Does your "Temporarily suspend savefile updates" do [something like] this?
I don't have such an icon yet - I was wondering if that was the function you wanted. I think that's a nice idea to have an icon to switch between savetime of 0 and 30. (ie: this icon could be called "switch between auto save & manually controlled save"). Maybe the icon could just bring up a dialog? (although I prefer to use just a single click...)

Maybe we need RSH version of shutdown menu all the time on the desktop.
RSH wrote:Already done in LazY Puppy 2!
Nice.

User avatar
Barkin
Posts: 803
Joined: Fri 12 Aug 2011, 04:55

#15 Post by Barkin »

IMO the "save" and "nosave" icons above are too similar and could be mistaken for each another. They should be much more dissimilar, e.g. attached ...
Attachments
another-nosave-icon.png
another nosave icon
(2 KiB) Downloaded 4094 times
another-nosave-icon.png.png
another nosave icon
(2.27 KiB) Downloaded 3928 times
nosave-S-48.png
alternative nosave icon
(3.42 KiB) Downloaded 3961 times
Last edited by Barkin on Wed 12 Dec 2012, 00:47, edited 2 times in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#16 Post by greengeek »

Barkin wrote:IMO the "save" and "nosave" icons are too similar and could be mistaken for each another.
True. I've now stolen your icon for future use and also modified the save one. Thanks!
:-)
Attachments
save grn.jpg
(31.84 KiB) Downloaded 965 times

dcc701
Posts: 62
Joined: Wed 23 Apr 2014, 07:40
Location: Seattle, US

#17 Post by dcc701 »

green geek's rc.shutdown code modification (above, first page) seems very useful to me, but I feel like it needs update before I could use it in tahrpup. The code at "13)" is quite a bit diff in tahrpup and I'm afraid of making an error.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#18 Post by greengeek »

Hi dcc - I haven't used Tahrpup yet so unfortunately I can't recommend a solution. However, I thought that Tahr had a new type of setup for selecting save or no save at shutdown, quite different to other puppies - it may be worth asking a question about this in the Tahr thread.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#19 Post by mikeb »

nohup busybox shutdown

that makes it kick the bucket :D

mike

dcc701
Posts: 62
Joined: Wed 23 Apr 2014, 07:40
Location: Seattle, US

#20 Post by dcc701 »

Hi greengeek--Thanks for reply. I actually did recently post a newbie question on the issue of customizing defaults on that tahrpup save/notsave shutdown routine. That is working, but I'm thinking for my use it'd also be nice to just have a "forget" button on the desktop, right near the "save" button!

mikeb--That looks like some serious code there! Would it fry my computer?

Post Reply