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

#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?

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

#21 Post by mikeb »

mikeb--That looks like some serious code there! Would it fry my computer?
well a terminal one liner ... just goes straight to busybox shutdown... its not really any worse than the normal shutdown routine in terms of drive unmounting.

the nohup makes sure it carries on regardless to the bitter end :) Also handy if you ever remote control a pup.

mike

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

#22 Post by mikeb »

forum notification glitch..seem to happen a lot at the moment.

mike

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

#23 Post by greengeek »

mikeb wrote:nohup busybox shutdown
This will bypass the normal 'soft shutdown' features though won't it? What about sfs, drive and filesystem unmounts? By still using the rc.shutdown method I was trying to retain those functions for safety - just avoiding the save process itself.

EDIT : I do use a different method on some of my systems - I made an icon and script I call "Quickdown". Don't know if it would be applicable to other Tahrpups but here is the code:

Code: Select all

#!/bin/bash
#2014May16  greengeek code to unmount drives then perform busybox shutdown. Intended for 
#use with BanksyPup live puppy environment where quick shutdown without save is required.


####Musher0 code to unmount only disks
df -H -T -x squashfs -x tmpfs -x rootfs -x aufs -P | grep "/mnt/s" | cut -f2 -d'm' > spc_dsq.txt
while read line
do
umount /m$line
done < spc_dsq.txt
rm -f spc_dsq.txt
sleep 3

exec /bin/busybox poweroff
Attachments
quickdown48.png
(4.87 KiB) Downloaded 414 times
desktop_shutdown_options.jpg
(7.39 KiB) Downloaded 416 times

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

#24 Post by mikeb »

Its not that soft... busybox unmounts what it can and the union will not either way.

The only true way of shutting down cleanly in puppy is to be entirely in ram.
I did hear of someone who painstakingly was able to unmount pup_rw/save file but it all seemed a bit hit an miss.

mike

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

#25 Post by dcc701 »

Hi greengeek--
Thanks. Is your "Quickdown" script in /usr/bin? Does anyone know if this would be OK for tahrpup or not?
Nice set of icons.

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

#26 Post by greengeek »

dcc701 wrote: Is your "Quickdown" script in /usr/bin?
Yes, I place it in /usr/bin.
Does anyone know if this would be OK for tahrpup or not?
I think it should be fine in Tahrpup - especially if you replaced the last line (invoking busybox) with mikeb's version (using nohup with busybox)

It would be worth trying by booting Tahr in "live session" with your savefile/savefolder hidden temporarily. If it works this way then I would expect it to work with savefile/savefolder too.

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

#27 Post by dcc701 »

greengeek--
Works! Thanks!
However I tried changing your last line
exec /bin/busybox poweroff
to
exec /bin/nohup busybox poweroff
and it didn't work.
I took out "nohup" and it works.
Also tried
exec /bin/nohup busybox shutdown
and it didn't work.

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

#28 Post by mikeb »

perhaps nohup gets moved around or its not in all pups.

Its not essential for scripts usually..I find its needed if running from a virtual terminal or remotely via ssh Thats mainly as puppys boot structure leaves you in a strange place in linux terms and there is no shutdown binary..nohup gets you through that rather than ending up in an endless loop or messing up saving.

mike

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

#29 Post by greengeek »

dcc701 wrote:However I tried changing your last line
exec /bin/busybox poweroff
to
exec /bin/nohup busybox poweroff
and it didn't work.
As mike says - there are potentially differences between pups. I use a Slacko 5.6 derivative and have just successfully tried changing the last line like this:

Code: Select all

exec nohup busybox poweroff
Pup knows it's own paths better than I do :-)
Worth a try anyway.

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

#30 Post by mikeb »

The path to puppy nirvana is a changeable one :D

mike

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

#31 Post by dcc701 »

How true, mikeb!
Just a caution to anyone else who does the above:
This worked, but it somehow disabled rc.shutdown's asktosave function, which ceased working as soon as I created the above script.
So it might be an either/or proposition in tahrpup: either you can have a "not save" script with icon on the desktop, or you can use built-in asktosave, but not both!
I'm just kind of weighing which I prefer.
Thanks everyone!

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

#32 Post by greengeek »

dcc701 wrote:This worked, but it somehow disabled rc.shutdown's asktosave function,
Yes, the quickdown script does not use rc.shutdown at all - it just uses busybox to drive the shutdown (with Musher0's additional steps to handle drive unmounting). It is just a method for a user who has already made the decision that they do not want to save (and therefore does not want a further 'ask-to-save' question)

The other method listed on page 1 involves changes to rc.shutdown but as you pointed out the shutdown functionality has all been changed in tahrpup so the method would have to be modified to accommodate the new style of rc.shutdown. Unfortunately I don't feel competent to make such changes as I have so far avoided the recent "save to file" and "asktosave" developments in favour of not running a savefile at all. (I currently use a personalised sfs instead - which does not retain daily 'saved' changes at all)

I may eventually get up to speed with the modern pups and the new shutdown methods but probably later rather than sooner.

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

#33 Post by mikeb »

Yes its all a bit obsolete to me too...been using a save sfs for years ..though that DOES save changes. I have had save folder too but never use it with puppy for other reasons plus its my scripts so different anyway.

Such fast shutdown only come into play if I manage to make the system go crosseyed experimenting :D

I suppose choosing the fast shutdown would effectively be the choice and not saving is part of that...

mike

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

rc.shutdown mod for tahrpup 6.0.2

#34 Post by gyro »

If you want to implement the original concept in Tahrpup 6.0.2, try the following:
In rc.shutdown replace

Code: Select all

if [ "$ASKTOSAVE" = "false" ]; then
  RETVAL=0
else
with

Code: Select all

if [ "$ASKTOSAVE" = "false" ]; then
  #If "No_save" flag file exists set RETVAL so save is avoided
  if [ -f "/tmp/No_save" ]; then
   RETVAL=1
  else
   RETVAL=0
  fi
else
Later code only does a save if this 'asktosave_func' returns 0

Note: Use at your own risk. It's not tested since I usually run in PUPMODE=12, and this code does not apply.

gyro

Post Reply