You are not logged in.
Pages: 1
I have written a little backup script that I can use with cron to save my data. It adds all files with absolute path names in an archive. The archive can be either gzip or bzip2 compressed.
It depends on python and there is time and date support for the name of the archive.
Some examples:
alexander:~$ apbp -v -x workplace.tar.gz -i workplace/archhurd,workplace/haskell workplace
You can also create a backup file:
alexander:~/backup_scripts$ cat schule
#!/usr/bin/apbp -c
archive=/home/backups/schule_%Y-%m-%d_%H:%M.tar.gz
files=/home/alexander/Schule
ignore=/home/alexander/Schule/vbshare,/home/alexander/Schule/DrupalMachine.vdi
replace
alexander:~/backup_scripts$ apbp -c schule
If you add replace in your backup file, the previous archive file will be replaced by the new archive.
Because of the shebang you could also use it as script.
alexander:~/backup_scripts$ chmod +x schule
alexander:~/backup_scripts$ ./schule
If you lost data like I did (rm -fr * FTW) you can also restore the data.
alexander:~$ apbp -r /home/backups/workplace.tar.bz2
Do NOT restore old archives! It will overwrite your original files.
Here is my crontab:
0 9 * * * $HOME/backup_scripts/savegames
0 9 * * fri $HOME/backup_scripts/schule
0 9 * * mon $HOME/backup_scripts/workplace
I hope you like it .
The script is available on the aur.
AUR: http://aur.archlinux.org/packages.php?ID=35834
Last edited by Giselher (2010-03-22 16:31:43)
Offline
Seems very nice! I'll give it a try when I find the time to do so
Offline
I have added two new features.
* partial restore
apbp -r some.tar.gz /home/test/lostmydata
This will only restore the file (or files in this directory) you give.
I added this feature because nobody will really restore everything form the backup archive.
* different separator
apbp -s : -i /home:/etc:/dev /
#!/usr/bin/apbp - c
name= ...
separator=SEP
files=/homeSEP/etcSEP/root
#!/usr/bin/apbp -s '||' - c
name= ...
files=/home||/etc||/root
I added this feature because sometimes there are commas in pathnames
I will update the aur packages as soon as possible
EDIT: AUR packages is now up to date
Last edited by Giselher (2010-03-22 18:29:55)
Offline
With apbp 1.2 its possible to enter how many files will be kept before the oldest will be replaced .
#!/usr/bin/apbp -c
name=...
...
replace=3
The script will keep 3 files and will remove the oldest if a new archive is created.
replace=0 Will keep all files.
replace == replace=1
Last edited by Giselher (2010-03-24 11:00:42)
Offline
Pages: 1