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 Fri 28 Jul 2017, 03:04
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Daily Backups for Your Puppy
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
musher0


Joined: 04 Jan 2009
Posts: 10550
Location: Gatineau (Qc), Canada

PostPosted: Thu 16 Mar 2017, 00:07    Post subject:  Daily Backups for Your Puppy
Subject description: Also known as "dailies"
 

Hello all.

As per Flash's suggestion here, I'm opening this thread about daily
backups, aka dailies.

It saw the light of day as an answer to a question by member scientist.

Then I realized that we had nothing like it, and that it is quite a good idea
finally to save the daily bits of your computing every day. And I continued
adding features to it.

Of course, this kind of backup doesn't move mountains, but that's the
idea: to be almost unnoticeable, automatic, and efficient.

If on a particular day, something in your system breaks, you unpack your
latest dailies, copy their contents in your system and you're back in
business in no time.

We have to thank Barry Kauler for his foresight. I'm just making use of the
start / stop feature he designed for Puppys's /etc/init.d directory.

~~~~~~~~

Please note that you still must do, IMO, regular back-ups, by compacting
your pupsave file as a lzop file with SFR's PackIT, every second day, for
example; or whatever means you usually use. "When things go wrong, you
never have enough back-ups." (Old French-Canadian saying.) Wink

Anyway, you can read the genesis, etc., in the other thread. I'm not sure I
mentioned it elsewhere, but this script uses good old zip and the much
newer lzip. The script needs both. And you will too if you ever need to
access the contents! Wink

So... here's the message transfer!

Enjoy ! BFN.

~~~~~~~~~~~~~~~
Hello all.

Time flies, doesn't it?

This is version 3d. It contains a number of improvements, you be the judge.

For one, I changed the licence to GPL3.

An interesting one, I think is a line added to the time tag at line 87 of the
script, to mention which pupsave this daily is for.

It can help dissipate the confusion if you use 2 or 3 pupsaves with the
same Puppy.

The name of the archive is derived from the name of the Pup, contains the
date, and the numbering of the archive (if you make more than one
computer session during the day).

File /root/Daily_zip.note inside the archive now also contains which pupsave
this daily was made for.

IHTH.

Code:
#!/bin/sh
# /etc/init.d/stop_today-files3d # A daily archiving script.
# Requires zip and lzip (both are usually in modern puppies).
#
# This is a twin script of today-files3c.sh, without the checking /
# display part at the end. This script uses instead the test of
# the archive provided by zip itself.
#
# To use: copy this script as < stop_today-files3d > in /etc/init.d/
# and make executable.
#
# You may change the receiving PARTition at line 21 below
# to suit your system.
#
# Comments, usage notes, checking/display section and choice of receiving
# partition in script < today-files3c.sh >  (q.v.) removed for brevity.
#
# (c) Christian L'Écuyer (aka musher0), July 12, 2015.
# Rev.: April 20 & 24-25, May 8 and Aug. 18, 2016, March 15, 2017.
# All rights reserved / Tous droits réservés. GPL3
####
# variables
PuP="`awk -F"'" '$1 ~ /_NAME/ { print $2 }' /etc/DISTRO_SPECS`" # 18 août 2016
PART="home" # Or define your own.
cd /mnt/"${PART}"

# Added 2016-04-20:
DaT="`date '+%Y-%m-%d'`"

# It is now possible to have an unlimited number of archive files.
count="`ls -1 "${PuP}"-"${DaT}"-files*lz | wc -l`"
count="`expr $count + 1`"
FileS="files${count}"
# Useful if you do many sessions on the same day.
#
# Downside: does not create a timed update, grabs all dailies every time,
# because lzip does not have an update command. Also, on the practical level,
# decompressing the lzip file and unzipping and updating the zip archive will
# lenghten the shutdown cycle, which we want to keep as brief as possible.
# You may wish to keep only the highest-numbered archive of the day
# upon later review.
#
# Upside: this limitation may be useful to do some versioning.
# End of edit.

# functions
mklzip () {
lzip -9m64 -f "${PuP}"-"${DaT}"-"${FileS}".zip
}

# unlzip (){
# cd /mnt/"${PART}"
# lzip -d -k "${DaT}"-"${FileS}".zip.lz
# } # Example of how to decompress an lzip file. # Added 2016-04-20.

# Action
# Exception: Skip the "dailies" archiving for the date
# on which an ?drv_*.sfs was created. This is rather for
# developers. The regular user won't need this. But it's
# not an annoyance for anyone. # Added 2016-04-24 & 25.
ModE="`awk -F"=" '/PUPMODE/ { print $2}' /etc/rc.d/PUPSTATE`"
if [ "$ModE" = "12" -o "$ModE" = "13" ];then # Limits
   composante=""
   > /tmp/liste.drv

   for composante in ADRV= FDRV= YDRV= ZDRV=
   do
      DrV="`awk -F"'" '$1 ~ /'$composante'/ { print $2 }' /etc/rc.d/PUPSTATE | awk -F"," '{ print $NF }'`"
      DrV="/mnt/home$DrV"
      [ "${#DrV}" -gt "9" ] && echo "$DrV" >> /tmp/liste.drv
   done
   cat /tmp/liste.drv

   > /tmp/liste.drv1
   for i in `cat /tmp/liste.drv`
   do
      ls --time-style="+%Y-%m-%d" -Algo $i >> /tmp/liste.drv1
   done

   Nombre="`awk '/'"$DaT"'/ { print $NF }' /tmp/liste.drv1 | wc -l`"

   if [ "$Nombre" -gt "0" ];then
      for Fichier in `awk '$4 ~ /'"$DaT"'/ { print $NF }' /tmp/liste.drv1`
      do
         cp -f --backup "$Fichier" "$Fichier".cdr
      done # Si on a installé le jour même, on fait une copie de réserve.
   else # Sinon, on fait la sauvegarde quotidienne ordinaire.
      echo "Daily zip archive / Archive zip quotidienne
For: / Pour : `grep PUPSAVE /etc/rc.d/PUPSTATE`
$DaT, # / n. $count." > /root/Daily_zip.note # Added 2016-04-20, 2017-03-15.
      zip -lf /mnt/"${PART}"/zip.log -la -0 -r -y -FI -t "${DaT}" /mnt/"${PART}"/"${PuP}"-"${DaT}"-"${FileS}" /initrd/pup_rw
# /bin /etc /lib /opt /sbin /root /usr /var
# -x /tmp /dev /sys /initrd /mnt # pas nécessaire
# 2016-04-20: Added < -FI > parameter to include FIFO files.
      if [ ! -d /initrd/pup_rw/root/my-* ];then
         zip -lf /mnt/"${PART}"/zip.log -la -0 -r -u -t "${DaT}" /mnt/"${PART}"/"${PuP}"-"${DaT}"-"${FileS}" /root/my-*
# 2016-05-09
      fi
      touch /mnt/"${PART}"/"${PuP}"-"${DaT}"-"${FileS}".zip
# 2016-05-08 # Essai de correction de l'erreur de date.
      rm -f /root/Daily_zip.note

      mklzip
   fi
fi
## 30 ##
stop_today-files3d.zip
Description  Unzip in /etc/init.d and make executable. Then please move the zip archive
out of /etc to a safe storing place. No extraneous files should be in /etc.
zip

 Download 
Filename  stop_today-files3d.zip 
Filesize  1.99 KB 
Downloaded  23 Time(s) 

_________________
musher0
~~~~~~~~~~
« Un insensé sur le trône n'est qu'un singe sur le haut d'un toit. » / "A madman
on the throne is just a monkey on top of a roof." (Bernard de Clervaux)

Last edited by musher0 on Thu 13 Apr 2017, 03:44; edited 1 time in total
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 10550
Location: Gatineau (Qc), Canada

PostPosted: Thu 16 Mar 2017, 22:39    Post subject:  

Just saving the thread from falling into limbo! Wink
_________________
musher0
~~~~~~~~~~
« Un insensé sur le trône n'est qu'un singe sur le haut d'un toit. » / "A madman
on the throne is just a monkey on top of a roof." (Bernard de Clervaux)
Back to top
View user's profile Send private message 
slavvo67

Joined: 12 Oct 2012
Posts: 1415
Location: The other Mr. 305

PostPosted: Fri 17 Mar 2017, 23:31    Post subject:  

Hi Musher0:

I hope you don't mind me adding that for those using Quirky, you should have a 2nd one so if your USB stick fails to boot, you can usually boot a 2nd Quirky and mount the stick that doesn't boot so you can copy things over.

Quirky also has a snapshot manager but I'm pretty sure it won't handle a boot problem.

Anyway, just adding my experiences with Quirky. And thanks for the Puppy backup. I'll need to try it out!
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 10550
Location: Gatineau (Qc), Canada

PostPosted: Fri 17 Mar 2017, 23:55    Post subject:  

Hi slavvo67.

Nice hearing from you.

Having no experience at all of BK's current Quirky, I don't think I'll venture
into the territory. Maybe you could adapt it!

That said, could you explain a little more? Reboot capacity from USB
sounds like an interesting feature, But I'm unclear about how it could (or
should) be done from a daily backup script.

What I mean is:
Let's say, for the sake of example, that you had some kind of failure, You
can then re-boot your Puppy without any pupsave, unpack the most recent
"daily" archive, and repair your pupsave with the files in the "daily", since
the pusave is not active.

But perhaps this is not your meaning? TIA for any pointers.

BFN.

_________________
musher0
~~~~~~~~~~
« Un insensé sur le trône n'est qu'un singe sur le haut d'un toit. » / "A madman
on the throne is just a monkey on top of a roof." (Bernard de Clervaux)
Back to top
View user's profile Send private message 
slavvo67

Joined: 12 Oct 2012
Posts: 1415
Location: The other Mr. 305

PostPosted: Sat 18 Mar 2017, 00:08    Post subject:  

Ok. Well, Barry's Snapshot Manager basically takes a full snapshot of your Quirky. Assuming you can boot, you can reinstate any of maybe 5 different backups that you created over the course of time.

The thing is, I usually beat up my Quirkies with test files, compiling errors, open ended scripts, etc.... I'm likely to destroy one after the other....until one does not boot anymore. For me, it's just another day at the keyboard...LOL So when they don't boot, I always have another Quirky to pop into the computer and boot up. I never had a problem mounting a USB with a version of Quirky that I blew up. So, it won't boot but it will mount! Then, I can at least transfer my files off and reinstall a fresh Quirky on that stick.

Not sure of your script in Quirky but still, a welcome addition in Puppy for sure!

Hope your well!!

P.S. - Saw a bunch of your Canadian friends in Hollywood Beach, FL a few days back. It's a cool 70 degrees down here right now... Wink
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 10550
Location: Gatineau (Qc), Canada

PostPosted: Sat 18 Mar 2017, 00:18    Post subject:  

You're quite the tease, you know, with your 70 F in Florida -- after the huge
snow storm we had this week! Laughing 2 F here right now!

Best.

_________________
musher0
~~~~~~~~~~
« Un insensé sur le trône n'est qu'un singe sur le haut d'un toit. » / "A madman
on the throne is just a monkey on top of a roof." (Bernard de Clervaux)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0774s ][ Queries: 15 (0.0084s) ][ GZIP on ]