backing up kmail
Donn
donn.ingle at gmail.com
Wed May 2 23:32:37 UTC 2007
> I'd like to back up my kmail files and it seems that a simple copy would
> work. I'm having trouble, though, in that the directory structure and some
> of the files are copied, but some directories end up empty. This occurs
> whether I copy from a shell or using Konqueror, whether or not I have root
> permission, and regardless (seemingly) of the permissions assigned to the
> directories and files to be copied.
>
> Any ideas?
One: rsync.
Here's my 'megabackup' script. I make it executable (chmod) and the run it on
a schedule (cron) every night. I'll explain after.
-----------------script follows------------------------
#First backup location - external drive
T=/media/sda1/SOMEFOLDER
#Second backup location:
T2=/media/sdb1/SOMEFOLDER
[ ! -d "$T" ] && echo "sdb1 not available" && T="BAD"
[ ! -d "$T2" ] && echo "$T2 not available" && exit 1
S=/home/YOURUSERNAME
echo "backup start :" `date` > /home/YOURUSERNAME/report
##A trailing slash on the source means dirs will
##be correct on target!
s[1]=$S/01.Info/
t[1]=01.backup_Info
s[2]=$S/.tomboy/
t[2]=tomboy
s[3]=$S/00.Admin/
t[3]=00.backup_Admin
s[4]=$S/02.Skeptic/
t[4]=02.backup_Skeptic
s[5]=$S/05.MyStuff/
t[5]=05.backup_MyStuff
s[6]=$S/JOBS/
t[6]=backup_JOBS
s[7]=$S/Projects/
t[7]=backup_Projects
s[8]=$S/scripts/
t[8]=backup_scripts
s[9]=$S/Mail/
t[9]=backup_Mail
s[10]=$S/.kde/
t[10]=backup_dotkde
s[11]=$S/.mozilla/
t[11]=backup_dotmozilla
s[12]=$S/public_html/
t[12]=backup_public_html
len=${#t[@]}
i=1
while [ "$i" -le "$len" ]
do
S=${s[$i]}
TARGET=$T/${t[$i]}
[ "$T" != "BAD" ] && rsync -vurtl --safe-links --delete "$S" "$TARGET"
>> /home/YOURUSERNAME/rsync.out
TARGET=$T2/${t[$i]}
rsync -vurtl --safe-links --delete "$S" "$TARGET"
>> /home/YOURUSERNAME/rsync.out
((i=i+1))
done
echo "backup end :" `date` >> /home/YOURUSERNAME/report
cat /home/YOURUSERNAME/report | mail -s "backup report" YOURUSERNAME at HOSTNAME
----------------script ends--------------------
So, it uses rsync to do the actual magic. The rest is just an easy (I think)
way to describe what I want backed-up and to where. The last line sends me an
email report, which you could skip.
You set T and T2 to the locations of your backup drives. If T fails, it
continues. If T2 fails, it stops. These are just details, you can change all
that. In the variables s[] and t[], s means source and t means target. They
are simply arrays and you can make as many as you like.
Open a console and type "man rsync" (man chmod, man crontab) for more details.
Well, hth
/d
More information about the kubuntu-users
mailing list