Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 25 Oct 2014, 02:42
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
How can I save to pup001 file on a schedule?
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
dvw86


Joined: 04 May 2005
Posts: 636
Location: Washington State

PostPosted: Sat 13 Aug 2005, 15:56    Post_subject:  How can I save to pup001 file on a schedule?  

I have Puppy running in RAM and often do not reboot for days, so a sudden power outage (like my kids pushing the reset button) could cause me to loose a lot of work. I would like a little script that would save everything back to the pup001 file like the rc.reboot script does, but without rebooting. I looked at stripping that script down but I'm not quite sure what all of it does. Does anybody have any advise to get me started? Thanks
Back to top
View user's profile Send_private_message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Sat 13 Aug 2005, 19:56    Post_subject:  

I presume you're booting off usb, so all of pupxxx got copied onto ramdisk?

If so, yeah, a big button on the desktop to do that, or even an automatic thing that does it every say 5 minutes ...Puppy does have a background daemon script called "check_space" that could be extended to do this.

This is on my to-do list, maybe it will interest somebody.
/tmp/rc.reboot has the shutdown script, need the code out of there to see how writing back to pupxxx file is done.
Back to top
View user's profile Send_private_message Visit_website 
dvw86


Joined: 04 May 2005
Posts: 636
Location: Washington State

PostPosted: Sat 13 Aug 2005, 20:42    Post_subject:  

Actually I have it installed onto the hard drive but have it loading into RAM as discussed here. It's the same basic set up as booting from a USB drive. I wouldn't mind writing or modifying the script, but I'm not sure what all the script is doing. I'm guessing that this is the place to start.
Code:

#v0.9.8 (see /sbin/init and /etc/rc.d/rc.sysinit)
if [ -f /tmp/pupxxxshutdown.txt ];then
. /tmp/pupxxxshutdown.txt
 #echo
 echo "Please wait, copying /root to $PUPMNTPOINT..."
 echo "(writing back to the pupxxx file on the USB drive from ramdisk)"
 rm -fr $PUPMNTPOINT/*
 #...heh, heh, this leaves behind hidden files/dirs, so do this...
 rm -fr $PUPMNTPOINT/.[a-zA-Z0-9]*
 sync
 cp -af /root/. $PUPMNTPOINT
 sync
 echo "...done"
  echo "Zeroising unused portion of pupxxx partition..."
  PARTFREE=`df | grep "$PUPMNTPOINT" | tr -s " " | head -n 1 | cut -f 4 -d " "`
  dd if=/dev/zero of=$PUPMNTPOINT/empty.tmp bs=1024 count=$PARTFREE > /dev/null 2>&1
  sync
  rm -f $PUPMNTPOINT/empty.tmp
  sync
  echo "...done"
 #rm -f /tmp/pupxxxshutdown.txt #shouldn't be necessary as /tmp pristine at bootup.
Fi
Back to top
View user's profile Send_private_message 
Bruce B


Joined: 18 May 2005
Posts: 11130
Location: The Peoples Republic of California

PostPosted: Sat 13 Aug 2005, 22:48    Post_subject:  

dvw86 wrote:
Actually I have it installed onto the hard drive but have it loading into RAM as discussed here. It's the same basic set up as booting from a USB drive. I wouldn't mind writing or modifying the script, but I'm not sure what all the script is doing. I'm guessing that this is the place to start.


[cut]

I don't interpret anything written in the posts at the link you referenced as loading pupxxx file to RAM. As near as I can read it, pupxxx is sitting on the hard disk and being written to each time you save your work. I could be wrong, that's why I have a ?
Back to top
View user's profile Send_private_message 
dvw86


Joined: 04 May 2005
Posts: 636
Location: Washington State

PostPosted: Sat 13 Aug 2005, 23:03    Post_subject:  

I could be wrong, but I believe that the line root=/dev/ram0 ramdisk_size=16384 loads Puppy into RAM. I know that if I create a file and save it, the file is gone if I suddenly loose power to the computer or if I press the reset button. If I do a proper shut down the file is still there when it boots back up.
Back to top
View user's profile Send_private_message 
Bruce B


Joined: 18 May 2005
Posts: 11130
Location: The Peoples Republic of California

PostPosted: Sat 13 Aug 2005, 23:15    Post_subject:  

I could be wrong but I think your pupxxx file is being used from the hard disk.

How about making a quick calculation by booting the computer and running the free command. I think you will be able to roughly calculate if there is a 256 MB* pupxxx file sitting in RAM along with the other files from image.gz, usr_cram.fs and normal system usage.

* or whatever size it is on your 'puter
Back to top
View user's profile Send_private_message 
dvw86


Joined: 04 May 2005
Posts: 636
Location: Washington State

PostPosted: Sat 13 Aug 2005, 23:29    Post_subject:  

total 482992
used 451100
free 31892
Back to top
View user's profile Send_private_message 
Bruce B


Joined: 18 May 2005
Posts: 11130
Location: The Peoples Republic of California

PostPosted: Sat 13 Aug 2005, 23:31    Post_subject:  

It appears like your pupxxx is in RAM huh? It is in RAM you better come up with a way of periodically saving files Smile

I think an option 1 typically fits together simplistically something like this:

    /bin/ files are in RAM - generated each boot by image.gz
    /dev/ files are in RAM - generated each boot by image.gz
    /etc@ files are on hard disk inside pupxxx
    /lib/ files are in RAM - generated each boot by image.gz
    /mnt/ the mount points are generated each boot by image.gz
    /proc/ files in RAM generated by the system
    /root/ the mounted pupxxx
    /sbin/ files are in RAM - generated each boot by image.gz
    /tmp/ created by image.gz and used by various process throughout the session
    /var/ is generated by image.gz and possibly added to during the session - all is lost on reboot
    /usr/ files are in RAM - generated each boot by usr_cram.fs
    AND
    /usr/ is also from the pupxxx file at /root/.usr and as far as precedence and priority it
    rates high, meaning whatever is in /root/.usr has presedence to what was in usr_cram.fs when
    it was loaded.


Edit note: the only significant difference between the GRUB instructions I've been using and the ones in the thread is the ramdisksize. I figured that was more for making sure there was adequate space to expand image.gz
Back to top
View user's profile Send_private_message 
PaulR

Joined: 04 May 2005
Posts: 246
Location: UK

PostPosted: Tue 16 Aug 2005, 17:13    Post_subject:  

dvw86 wrote:
I know that if I create a file and save it, the file is gone if I suddenly loose power to the computer or if I press the reset button. If I do a proper shut down the file is still there when it boots back up.


Probably a stupid idea but is it not possible to reboot via a cron job so all your stuff gets kicked out to disk?
Back to top
View user's profile Send_private_message 
dvw86


Joined: 04 May 2005
Posts: 636
Location: Washington State

PostPosted: Tue 16 Aug 2005, 20:56    Post_subject:  

PaulR wrote:
Probably a stupid idea but is it not possible to reboot via a cron job so all your stuff gets kicked out to disk?


I think that cron is a great idea. It has been on my to-do list. I would just have it run a "save-to-disk" script rather than the reboot script though. My problem is getting the right save-to-disk script.
Back to top
View user's profile Send_private_message 
doopdoop

Joined: 28 Jul 2005
Posts: 48
Location: Magdeburg, Germany

PostPosted: Tue 16 Aug 2005, 22:00    Post_subject:  

The problem could be time in this. If you have a larger pupXXX it needs some time to copy the whole thing to an USB stick.

Idea:
Let not really copy the thing, just check for differences.

1. Poorman's way: do a cp with the -u (update, just copies newer files)
2. Geek's way: Install fam (file alternation monitor), which checks for any change in a specified directory (here /root) and let a script react on this. Advantage: a little bit safer (does not depend on correct timestamp ) and less overhead, if there are a lot of files.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0704s ][ Queries: 11 (0.0031s) ][ GZIP on ]