How to Manually Save dat File?

Post here if you are a new Porteus member and you're looking for some help.
Post Reply
johnywhy
Samurai
Samurai
Posts: 108
Joined: 29 Mar 2017, 17:26
Distribution: Kiosk
Location: Cali

How to Manually Save dat File?

Post#1 by johnywhy » 03 Sep 2018, 03:08

How to manually save an existing dat file?
It's set to save on exit via cheat codes, but is there a way to save it without shutting down?
i searched Porteus docs, and could not find answer.

THX
Linux porteus 4.16.3-porteus #1 SMP PREEMPT - x86_64 Intel(R) Pentium(R) Dual CPU T2310 @ 1.46GHz GenuineIntel GNU/Linux

User avatar
Ed_P
Contributor
Contributor
Posts: 4918
Joined: 06 Feb 2013, 22:12
Distribution: 4.0 Cinnamon 64-bit ISO
Location: Western NY, USA

How to Manually Save dat File?

Post#2 by Ed_P » 03 Sep 2018, 03:33

Ed

johnywhy
Samurai
Samurai
Posts: 108
Joined: 29 Mar 2017, 17:26
Distribution: Kiosk
Location: Cali

How to Manually Save dat File?

Post#3 by johnywhy » 03 Sep 2018, 05:50

Nope, saw that one. If it involves saving a file outside of my dat file, that's not it.

I want to manually trigger the same update to the dat file that gets saved on shutdown.

I thought I read something about a "dump" command, but maybe mistaken.

THX
Linux porteus 4.16.3-porteus #1 SMP PREEMPT - x86_64 Intel(R) Pentium(R) Dual CPU T2310 @ 1.46GHz GenuineIntel GNU/Linux

User avatar
Ed_P
Contributor
Contributor
Posts: 4918
Joined: 06 Feb 2013, 22:12
Distribution: 4.0 Cinnamon 64-bit ISO
Location: Western NY, USA

How to Manually Save dat File?

Post#4 by Ed_P » 03 Sep 2018, 05:53

I understand and I think there is a way to do that I just don't remember what it is.

How big is your save.dat file?
Ed

johnywhy
Samurai
Samurai
Posts: 108
Joined: 29 Mar 2017, 17:26
Distribution: Kiosk
Location: Cali

How to Manually Save dat File?

Post#5 by johnywhy » 03 Sep 2018, 09:31

Ed_P wrote:
03 Sep 2018, 05:53
How big is your save.dat file?
on my new 32-bit install, about 100 MB used of 500 MB.
Linux porteus 4.16.3-porteus #1 SMP PREEMPT - x86_64 Intel(R) Pentium(R) Dual CPU T2310 @ 1.46GHz GenuineIntel GNU/Linux

User avatar
Ed_P
Contributor
Contributor
Posts: 4918
Joined: 06 Feb 2013, 22:12
Distribution: 4.0 Cinnamon 64-bit ISO
Location: Western NY, USA

How to Manually Save dat File?

Post#6 by Ed_P » 05 Sep 2018, 19:13

I think this thread is what you want johnywhy. changes=EXIT: manual update

To keep track of my save.dat file I use a couple of scripts. You might find this one useful.

Desktop file

Code: Select all

[Desktop Entry]
Name=SaveDatSpaceCk
Exec=sh /home/guest/Savedat/spaceck.sh
Icon=/usr/share/pixmaps/porteus/settings.png
Terminal=true
Type=Application
Name[en_US]=SavedatSpaceCk
StartupNotify=false 
spaceck.sh

Code: Select all

#!/bin/sh
# Add to /etc/rc.d/rc.local_shutdown.  And make rc.local_shutdown executable.
#                                      sudo chmod +x /etc/rc.d/rc.local_shutdown
# Bogomips help: http://forum.porteus.org/viewtopic.php?f=140&t=6069&p=47591#p47589
#                http://forum.porteus.org/viewtopic.php?f=140&t=6069&p=47614#p47598

# du -BM -d3 /mnt/live/memory/images/changes 

# Color definitions
txtbld=$(tput bold)               # Bold
txtred=${txtbld}$(tput setaf 1)   # Red
rst=$(tput sgr0)                  # Reset

function redwarning() {
echo -e $txtred "$1" $rst
}

#set -x;

if [ -a /mnt/live/memory/images/changes ]; then
   SDspace=$(df -BM --output=size,used,avail,pcent /mnt/live/memory/images/changes | tail -n1)
   Changes=/mnt/live/memory/images/changes
else
   BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
   if [ "$BOOTDEV" == "/mnt/isoloop" ]; then
      BOOTDEV=`grep -A1 "ISO=" /var/log/porteus-livedbg`
      BOOTDEV=${BOOTDEV:4:9}
   fi
   VERSION=$(cat /etc/porteus-version)
   FOLDER=porteus${VERSION:9:3}
   if [ ! -f $BOOTDEV/$FOLDER/changes/porteussave.dat ]; then
      echo "No $BOOTDEV/$FOLDER/changes/porteussave.dat file."
      read
      exit
   fi
#   echo "When prompted, enter guest's password."   https://forum.porteus.org/viewtopic.php?p=63884#p63884
   echo guest | sudo -S -u root mloop $BOOTDEV/$FOLDER/changes/porteussave.dat &>/dev/null        
   SDspace=$(df -BM --output=size,used,avail,pcent /mnt/loop | tail -n1)
   Changes=$BOOTDEV/$FOLDER/changes/porteussave.dat
   echo guest | sudo -S -u root uloop &>/dev/null
fi
# echo $SDspace
read size used avail percent <<< $SDspace
if [ ${percent%\%} -gt  85 ]; then
   echo 
   redwarning "Warning! save.dat file $percent full.  Used: $used  Free: $avail"
   echo 
   sleep 5
else
#   echo "save.dat file $percent full.  Used: $used  Free: $avail"
   if [ "$(which kdialog &>/dev/null)" ]; then
      kdialog --msgbox "save.dat file $percent full....Used: $used....Free: $avail"  
      exit
   else
#     Xdialog --msgbox "save.dat file $percent full.  Used: $used  Free: $avail" 33 128 
      Xdialog --rc-file /home/guest/Savedat/bluetxt.rc --title $Changes --msgbox "save.dat file $percent full - Used: $used - Free: $avail" 5 60
      exit
   fi
# http://xdialog.free.fr/doc/common.html#RCFILE
# http://www.murga-linux.com/puppy/viewtopic.php?p=523767&#523767
# guest@porteus:~$ Xdialog --colorsel 0 0 0
fi
The check can be done when the save.dat is in use and when in AF mode.

The main problem with the use of a save.dat file is if changes exceed it's capacity, and that can happen expectedly, it totally screws up the file. And you don't find out until the next time you boot. I've had save.dats of 128 MB, 256 MB, 320 MB and 512 MB, currently at 320 MB again.
Ed

johnywhy
Samurai
Samurai
Posts: 108
Joined: 29 Mar 2017, 17:26
Distribution: Kiosk
Location: Cali

changes=EXIT: manual update

Post#7 by johnywhy » 06 Sep 2018, 04:54

i'm getting:

Code: Select all

root@porteus:/home/guest# dump-session
syncing what's left in buffers
saving changes to /mnt/sda1//porteus32/porteussave.dat - this may take a while...
find: `bin': No such file or directory
find: `lib': No such file or directory
find: `opt': No such file or directory
find: `sbin': No such file or directory
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
...(forever)
Linux porteus 4.16.3-porteus #1 SMP PREEMPT - x86_64 Intel(R) Pentium(R) Dual CPU T2310 @ 1.46GHz GenuineIntel GNU/Linux

User avatar
Ed_P
Contributor
Contributor
Posts: 4918
Joined: 06 Feb 2013, 22:12
Distribution: 4.0 Cinnamon 64-bit ISO
Location: Western NY, USA

changes=EXIT: manual update

Post#8 by Ed_P » 06 Sep 2018, 05:49

I get:

Code: Select all

guest@porteus:~$ su
Password: 
root@porteus:/home/guest# dump-session
syncing what's left in buffers
saving changes to /mnt/sda6//porteus4.0/changes/porteussave.dat - this may take a while...
find: `bin': No such file or directory
find: `lib': No such file or directory
find: `lib64': No such file or directory
find: `opt': No such file or directory
find: `sbin': No such file or directory
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
sed: -e expression #4, char 1: unknown command: `_'
find: `bin': No such file or directory
find: `lib': No such file or directory
find: `lib64': No such file or directory
find: `opt': No such file or directory
find: `sbin': No such file or directory
session saved
root@porteus:/home/guest# 
If you scroll to the bottom you will see it says "session saved".

Why the errors, good question. :unknown:
Ed

User avatar
Ed_P
Contributor
Contributor
Posts: 4918
Joined: 06 Feb 2013, 22:12
Distribution: 4.0 Cinnamon 64-bit ISO
Location: Western NY, USA

changes=EXIT: manual update

Post#9 by Ed_P » 13 Oct 2018, 05:01

Ed_P wrote:
06 Sep 2018, 05:49
Why the errors, good question. :unknown:
Change line 20 in /opt/porteus-scripts/dump-session from:

Code: Select all

fixwh() { sed -e 's_\._\\._g' -e 's_?_\\?_g' -e 's_+_\\+_g' -e '_*_\\*_g' -e 's_\$_\\$_g' -e 's_\[_\\[_g' -e 's_(_\\(_g'  -e 's_\&_\\&_g' -e 's@^@^@'; }
to

Code: Select all

fixwh() { sed -e 's_\._\\._g' -e 's_?_\\?_g' -e 's_+_\\+_g' -e 's_*_\\*_g' -e 's_\$_\\$_g' -e 's_\[_\\[_g' -e 's_(_\\(_g'  -e 's_\&_\\&_g' -e 's@^@^@'; }
:happy62: :good:
Ed

Post Reply