Pbackup 3.1.9-1

Miscellaneous tools
Post Reply
Message
Author
User avatar
Gn2
Posts: 943
Joined: Mon 16 Oct 2006, 05:33
Location: virtual - Veni vidi, nihil est adpulerit

#16 Post by Gn2 »

A suggestion - Use cron to sync or backup as needed.
No need to backup all - just the changes.
Use (diff) in any script.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#17 Post by zigbert »

Thanks for info, shankargopal.
Your methode sounds interesting, and I'll put it into the manual. (will be made some time before 1.0).

But I wonder if PuppyBackups filetree fits your needs. PuppyBackup with mirrorfunction makes the path '/any_savepath/mirrordir1/*'. The mirrordir directory are made, so user knows that this is not original files. In your case maybe the mirrordir directory will come in your way. Maybe it should not been there at all.

shankargopal
Posts: 295
Joined: Sat 03 Dec 2005, 11:30

#18 Post by shankargopal »

zigbert,

I'm a little confused - I haven't actually used either PuppyBackup or PuppyMirror, preferring to stick for the moment to my script. So not sure if that directory would get in the way or not - though I don't see why it should. My method is basically this:

1. On the systems where I want to back up, I create an image file with an ext2 filesystem (named pupback.bak) on a suitable partition.
2. Run small script at start up to check all possible hard drive partitions for such an image file.
3. If such an image file exists, mount it every xx seconds (after an initial delay to give possibility of restoring backup if need be) and rsync it with certain directories as specified in a config file.
4. Ensure during shutdown that a final mirror is done.

That's it, really. I can post my makeshift script if you'd like, though I'm embarassed at showing it to any of y'all... :)

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#19 Post by zigbert »

shankargopal

If I understand you right, we are talking about a kind of "realtime" backup. Every backup system should have that feature, shouldn't it? :D In basic, that is not too difficult to put into existing PuppyBackup. The challenge is more how to set things up in existing GUI. We are now talking about a mix of PuppyBackup and crontab, and I try to keep focus on an easy-to-use backup. But in some future, like a flash from nowhere, everything seems clear. (Or, the other way - someboby posts a brilliant soultion on the Puppy forum) :wink:

Please show your script, show all of them...feedback is how we learn. Since my script can't do this task, your script could be a solution for others, or be an example of how to expand usage of PuppyBackup. That could be a part of the coming manual.

shankargopal
Posts: 295
Joined: Sat 03 Dec 2005, 11:30

#20 Post by shankargopal »

Sigh, here it is...

The main script that does the backing up - doesn't use cron, just sleeps for 60 seconds between back ups - is below.

Code: Select all

#!/bin/bash
if [ ! -f /root/.PUPBKDRV ]; then
	echo "ERROR. Could not locate .PUPBKDRV"
else
	COUNT=0
	while [ 1 -eq 1 ]; do
	# This if statement allows calling program to specify an initial delay or have this be a "final" run
	# i.e. just one run and then exit
	if [ "$COUNT" -eq 0 ] && [ "$1" != "" ]; then
		if [ $1 != "final" ]; then
				sleep $1
		else
			echo "Final backup running..."
		fi
	else
		sleep 60
	fi
	echo junga > /tmp/backup.running
	BACKPART="`cat /root/.PUPBKDRV`"
	BACKPARTFS="`probepart | grep $BACKPART | cut -f 2 -d "|"`"
	if [ ! $BACKPARTFS = "" ]; then
		[ ! -e /mnt/pupback ] && mkdir /mnt/pupback
		MOUNTED="`mount | grep $BACKPART | cut -f 3 -d " "`"
		if [ "$MOUNTED" = "" ]; then
			mount -t $BACKPARTFS $BACKPART /mnt/pupback
			if [ ! $? -eq 0 ]; then
				echo "Failed to mount backup partition"
				exit
			fi
			MOUNTED="/mnt/pupback"
		fi
		[ ! -e /mnt/backdatafile ] && mkdir /mnt/backdatafile
		mount -o loop -t ext2 $MOUNTED/pupback.bak /mnt/backdatafile 
		if [ $? -eq 0 ]; then
			echo "+++++++++++++++++++++++++++"
			echo "Starting Backup at"
			date
			DIRS="`cat /root/.BACKDIRS | tr "\n" " "`"
			if [ ! "$DIRS" = "" ]; then
				for DIR in $DIRS; do
					ACTDIR="`echo $DIR | sed -r "s/^\///" | sed -r "s/\/$//"`"
					if [ ! -e /mnt/backdatafile/$ACTDIR ]; then
						PATHSPLIT="`echo $ACTDIR | sed -r "s/\// /g"`"
						TOTPATH=""
						for PATHS in $PATHSPLIT; do
							TOTPATH="$TOTPATH/$PATHS"
							mkdir /mnt/backdatafile/$TOTPATH
						done
					fi 
					rsync -a -v --delete /$ACTDIR/ /mnt/backdatafile/$ACTDIR/
				done
			else
				echo "Can't find /root/.BACKDIRS"
			fi
			sync
			umount /mnt/backdatafile
			sleep 3
			[ "$MOUNTED" = "/mnt/pupback" ] && umount /mnt/pupback
		else
			echo "Could not mount backup file"
		fi
	else
			echo "Could not locate backup partition"
	fi
	rm /tmp/backup.running
	echo "==========================="
	let "COUNT+=1"
	if [ $1 = "final" ]; then
		exit
	fi
	done
fi
This script is called from this smaller script, which is called from rc.local on startup:

Code: Select all

#!/bin/bash
POSSPART=`probepart | grep --extended-regexp "vfat|msdos|ext2|ext3|ntfs" | grep --extended-regexp "hda|sda" | cut -f 1 -d "|" | tr "\n" " "`
if [ ! "$POSSPART" = "" ];then
	echo "Searching for pupback.bak on $POSSPART"
	killall pupbacker.sh 2> /dev/null
	for PARTI in $POSSPART; do
	    echo "Checking on $PARTI..."
	    if [ -e /mnt/pupback ]; then
			umount /mnt/pupback 2> /dev/null
		else
			cd /mnt
			mkdir pupback
		fi
		PARTFS=`probepart | grep $PARTI | cut -f 2 -d "|"`
		mount -t $PARTFS $PARTI /mnt/pupback
		if [ $? -eq 0 ]; then
				if [ -e /mnt/pupback/pupback.bak ]; then
					echo "Detected pupback.bak on $PARTI"
					echo -n "Checking if pupback.bak can be mounted..."
					if [ -e /mnt/backdatafile ]; then
						umount /mnt/backdatafile 2> /dev/null
					else
						cd /mnt
						mkdir backdatafile
					fi
					mount -t ext2 -o loop /mnt/pupback/pupback.bak /mnt/backdatafile
					if [ $? -eq 0 ]; then
						echo "success"
						umount /mnt/backdatafile 
						umount /mnt/pupback 
						echo $PARTI > /root/.PUPBKDRV
						echo "Starting PupBacker..."
						/root/Software/pupbacker.sh 300 > /root/Software/backup.log 2> /root/Software/backup.log &
						echo "YOU HAVE FIVE MINUTES TO RESTORE ANY BACKUP.TO GET MORE TIME, KILL pupbacker.sh"
						exit
					else 
						echo "FAILED to mount pupback.bak."
						umount /mnt/backdatafile
						umount /mnt/pupback
					fi
		      fi
			umount /mnt/pupback
		fi
	done
	echo "Failed to find pupback.bak"
	
else
	echo "Could not find any suitable partitions for backups"
fi
Finally, Ihave edited rc.shutdown to check if pupbacker is running, and if so to wait until it completes, or else to call "pupbacker.sh final".

I know there are a lot of hamhanded bits in both scripts, but please note I was writing with a lot of inexperience... this was almost a year ago.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#21 Post by zigbert »

version 0.7, see mainpost.

shankargopal.
Thank you for sharing your scripts.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#22 Post by zigbert »

Version 0.8. See main post.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#23 Post by zigbert »

Version 0.9. See main post.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#24 Post by zigbert »

version 0.9.4. See main post.

Now I really need testers.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#25 Post by MU »

0.9.4 already... you're just too fast ;)
Currently uploading Muppy 007 with Puppybackup 0.9.0.
But I did not test it myself yet.

Mark

brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

help

#26 Post by brad_chuck »

The program looks good. When I backup to hardrive from /root/my-documents/School to /root/backup . the files show up then when the "show backup files are in the dir" comes up.

When I hit OK and exit the program the files are not there.

I am using the compress option.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#27 Post by zigbert »

thank you, brad_chuck

Bug is fixed for next release. A workaround is to copy/move the *.tgz file before closing 'finished box'.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#28 Post by zigbert »

version 0.9.5. See main post.

MU, do you follow :wink:

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#29 Post by zigbert »

version 0.9.6. See main post.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#30 Post by MU »

Zigbert, did you forget to attach it?
Or am I getting old and blind? ;)

Thanks, Mark

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#31 Post by zigbert »

Ooophs :oops:

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#32 Post by zigbert »

Stable Version 1.0.0 and 1.8.0 development release is uploaded. See main post.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#33 Post by zigbert »

version 1.9.0. See main post.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#34 Post by zigbert »

version 1.9.1. See main post.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#35 Post by zigbert »

version 1.9.2. See main post.

Post Reply