I would like to monitor my Save Folder to watch how much it increases whenever there is a save to it.
How could I do that?
Thanks
Moderator: Forum moderators
I was thinking whenever the save button is pressed or when you acknowledge a save for shutdown/reboot,
it would send a time stamp and directory size to its own log file.
It could run a bash file that could have the command:
Code: Select all
du -skh dupupbw64save
.
I can see the code behind the save2flash button.
When you shutdown/reboot and it asks if you want to save - where would that code be?
Thanks
@JusGellin :-
Do bear in mind that at certain times of the day, or certain days of the week, even at certain times of the year, the Forum periodically goes through quiet spells. Members simply aren't online, because they're outdoors, or out & about, seeing family, taking time out.....doing OTHER stuff.
We do all have a life outside the Forum, y'know!
Be patient.
Mike.
Sure, I understand that. I just saw that the programming/script area was a really great place for scripting and this would be better over there.
I don't think I have the ability to move this to a different area.
Thanks
JusGellin wrote: Fri Aug 23, 2024 4:13 pmSure, I understand that. I just saw that the programming/script area was a really great place for scripting and this would be better over there.
I don't think I have the ability to move this to a different area.Thanks
I'll move it over for you. Look in the 'Programming' section to find it....
Mike.
whenever there is a save to it
If you are running pupmode 13
I think /usr/sbin/snapmergepuppy copies files
to the save file or folder.
I think putting a line at the bottom of the file
/usr/sbin/snapmergepuppy
might do what you want. That is, change the bottom line from this:
exit $ERRSTATUS
to something like this:
du -sh /initrd/pup_ro1/ >> /mnt/home/savefile.log
sync;sync
exit $ERRSTATUS
(assuming your savefile is mounted on /initrd/pup_ro1)
Depends which Puppy you are running,
what pupmode, etc etc.
sync;sync probably unnecessary.
du -h /initrd/pup_ro1/ | sort -h | tail
might log more info
@williams2
Its not getting any logs.
I added what you had:
I'm running BookwormPup64_10.0.7
Pupmode 13
The save2flash button file looks like it goes to snapmergepuppy file (I'm not sure how else to tell if it is using it)
At the bottom of the save2flash file, it has this which seems to reference that file:
Code: Select all
nice -n 19 snapmergepuppy
(assuming your savefile is mounted on /initrd/pup_ro1)
I don't know if it is. How can I tell?
Thanks for looking into this. I really appreciate it.
I'm not running Bookworm, so there are differences.
For my suggestion to work,
du needs to be before (above) the exit line at the bottom, not after.
The savefile is mounted on /initrd/pup_ro1/
The savefile is located in /mnt/home/
You can use Rox or other file browsers to look in those dirs, to see if everything looks right
The logfile named savefile.log should be in /mnt/home/
williams2 wrote: Sat Aug 24, 2024 4:37 amI'm not running Bookworm, so there are differences.
For my suggestion to work,
1. du needs to be before (above) the exit line at the bottom, not after.2. The savefile is mounted on /initrd/pup_ro1/
3. The savefile is located in /mnt/home/
You can use Rox or other file browsers to look in those dirs, to see if everything looks right
4. The logfile named savefile.log should be in /mnt/home/
1. Yes, I'm doing that.
2. I'm using a Save Folder - does that matter?
I don't know how to find where the save folder is mounted. How do I do that?
3. The save folder called dpupbw6410.0.7frugal is located in /mnt/home
4. It should go there, but hasn't yet because it hasn't been triggered. It should because the du is directed there.
I modified the snapmergepuppy with
Code: Select all
echo "testing file" >>/mnt/home/savefile.log
at the beginning of that file, then changed something and rebooted accepting save.
It didn't get anything from the beginning of that file. It must be going someplace else.
Thanks
@williams2
As soon as I sent the last response, the lightbulb went off
If I'm saving to folder then it must be a different file it goes to respond.
Sure enough, there's one called snapmergepuppy.overlay. I did the same thing you suggested at the end of the file.
It worked!
I'm just new enough to not catch that you were using a savefile and I've never done that before and accepted the savefolder instead when I save a session.
So I think I'm now good to go.
Thanks for making me think and helping me to go to the right place.
So now something else to modify for this.
Since I'm logging the savefolder instead, what should I use that matches the savefile for getting the size?
For the logging for the savefile, I was using
Code: Select all
du -s /initrd/pup_ro1/
What should I use like that if I'm using savefolder?
When I use /initrd/pup_ro1
, I don't get any changes when I save.
Thanks
If I wanted to log the size of my savefolder, dpupbw64save, is there a more generic thing to look at so I wouldn't have to be so specific for making this log?
For example to get the size of this directly I would have to use /mnt/home/dpupbw6410.0.7frugal/dpupbw64save/
@williams2 used /initrd/pup_ro1/
to log size for a savefile.
I would like to use something more generic if possible instead of /mnt/home/dpupbw6410.0.7frugal/dpupbw64save/
like he used.
Thanks
The goal of this is to be able to track the savefolder size whenever a save is made either from the save2flash button or when shutdown/reboot is made and save is selected.
This can be accomplished in Pupmode 13 using the /usr/sbin/snapmergepuppy.overlay file.
I did this using BookwormPup64_10.0.7.
Add the following to the very bottom of the file before the last commend of exit $ERRSTATUS
:
du -sb /initrd/mnt/dev_save/dpupbw6410.0.7frugal/dpupbw64save/ | awk '{print strftime( "%Y-%m-%d %H:%M:%S"), " \t" $1}' >> /mnt/home/savefolder.log
sync
Then when the save is made, the log file at /mnt/home/savefolder.log will get a new entry added like the following:
This will give a timestamp and the number of bytes.
2024-08-25 08:29:17 260796202
2024-08-25 08:29:32 260796202
2024-08-25 08:29:58 260796202
2024-08-25 08:30:19 260796202
I wanted to do this to learn more about the savefolder like what makes it increase, will it decrease, is it getting too large, etc.
I like how it works but wished I could make the specific part of the savefolder path, dpupbw6410.0.7frugal/dpupbw64save, more generic for using on other puppys.
This was a good learning experience for me to see better where things are and how to do this kind thing.
I would like to thank @williams2 for getting me going in the right direction. It helped me find a different file that savefolder uses compared
to the example he gave for using with a savefile system.