On 12/04/13 23:17, Nicolas Cauchie wrote:
> I tried this command :
> /usr/share/backuppc/bin/BackupPC_tarCreate -t -h test-host -s '*' -n
> -1 / >/home/test-host.tar
>
> It works perfectly. ;)
>
> In fact, I want to make what BackupPC GUI does (Start archive>Select
> all (in my case)>Archive selected hosts). I read that it must be done
> by an executable script with cron.
>
> So, your command makes a tar, then I must compress it with bzip2. Is
> there a way to compress it "on the fly" ?
>
> I ran the last command and I put "| bzip2 -v myfile.tar", at the end
> of the command, but it doesn't work, it makes me a file sizes 14o...
>
/usr/share/backuppc/bin/BackupPC_tarCreate -t -h test-host -s '*' -n -1
/ | bzip2 - > /home/test-host.tar.bz2
You want to redirect the output of BackupPC_tarCreate to bzip2 with a
pipe |, then you want bzip2 to read the data to compress from stdin (the
-) and then redirect the output of bzip2 to a file (the >)
Doing the compression will reduce disk writes, and potentially increase
performance, as long as the CPU can compress quickly enough. In my case
on an old pentium class CPU, the compression significantly slows down
the export.
> So, is there a way to make what BackupPC GUI does, automatically ?
> Cron job or anything else ?
To do this for all hosts you just need to get a list of hosts from
somewhere. For me, this could work:
egrep -v ^\#\|^host\|^$ /etc/backuppc/hosts | awk '{ print $1 }' | while
read host
do
/usr/share/backuppc/bin/BackupPC_tarCreate -t -h ${host} -s '*' -n
-1 / | bzip2 - > /home/${host}.tar.bz2
done
Personally, I'd add a lot more code to do the following:
* Check the output directory to ensure there is sufficient space before
and after the tar
* Create the output with the current date as part of the filename
* Delete the previous backup for this host *after* the new tar file is
created
Regards,
Adam
--
Adam Goryachev
Website Managers
www.websitemanagers.com.au
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
BackupPC-users mailing list
[email protected]
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/