BackupPC-users

Re: [BackupPC-users] Auto Archiving of hosts

2010-02-09 12:45:45
Subject: Re: [BackupPC-users] Auto Archiving of hosts
From: Timothy J Massey <tmassey AT obscorp DOT com>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Tue, 9 Feb 2010 12:41:51 -0500
Michael Osburn <michael.osburn AT echostar DOT com> wrote on 02/09/2010 
11:24:01 
AM:

> I need to get things confirmed with management first but I think 
> that doing the latest 
> would work for what I need.

I can't imagine why that wouldn't work (you're saving the same info, just 
a few weeks early!  :)  ), but sometimes management doesn't always see 
things the same way.

> I did not see the "-1" option when 
> looking at the archive 
> host option. Do you mind sharing your script?

It's not something you'd do from the GUI:  you would use it with the 
archive command from the command line.  I actually found it by reading the 
source code back when I was trying to figure out how to do this.

The biggest disadvantage is that all of the generated files from the same 
host will have the same name.  If you want to keep multiple copies of the 
archives you may have to either rename the files or put them into 
different subdirectories.  I asked that this be addressed in the BacukpPC 
archive command (have it substitute the proper backup number for the -1), 
but the request wasn't followed up on.


Here's the line in the backuppc user's crontab.  Note that it must be run 
as the backuppc user (or have some other script su it as backuppc).

04 07 *   *   6   /data/BackupPC/util/cron_archive localhost 5

And here's cron_archive.  It's designed for a Red Hat-based system.  The 
variables you might need to change are at the top.  ARCHIVE_HOST_PATH is 
the path to the archive host directory within BackupPC (where the archive 
request file will be generated), ARCHIVE_DEST_PATH is the path to store 
the generated archive, and BACKUPPC_BIN_PATH is the path to the BackupPC 
command files.

#!/bin/sh
# Script to create archive of BackupPC host for OBS Backup Server 2.1

ARCHIVE_HOST_PATH=/data/BackupPC/pc/archive
ARCHIVE_DEST_PATH=/data/archive
BACKUPPC_BIN_PATH=/usr/local/BackupPC/bin

parameters() {
    echo "$0 hostname par
    where hostname is the host to archve and par is the percentage of 
parity
    Example:  $0 localhost 5"
    exit 1
}

if [ -z $1 ]; then
    echo "You must include the hostname in the first parameter."
    parameters
fi

if [ -z $2 ]; then
    echo "You must include the percentage of parity in the second 
parameter."
    parameters
fi

echo "%ArchiveReq = (
   'archiveloc' => '"${ARCHIVE_DEST_PATH}"',
   'reqTime' => '946702800',
   'BackupList' => [
     '-1'
   ],
   'host' => 'archive',
   'parfile' => '"$2"',
   'archtype' => '0',
   'compression' => '/bin/cat',
   'compext' => '.raw',
   'HostList' => [
     '"$1"'
   ],
   'user' => 'backuppc',
   'splitsize' => '0000000'
);" > ${ARCHIVE_HOST_PATH}/archiveReq.cron.$$

${BACKUPPC_BIN_PATH}/BackupPC_serverMesg archive backuppc archive 
archiveReq.cron.$$



As you can see, the command generates an archive request file (which is 
exactly what the BackupPC archive GUI does) and saves it in the archive 
host's pc directory.  The archive is set up for no splits, no compression, 
and a variable amount of parity (some of my hosts are too big to generate 
parity in a timely manner).  If you want a different style of archive, 
simply capture the archive file generated by the GUI and modify the above 
information to better match your desired style of archive.

If you have further questions or comments, please feel free to ask.  For 
the record, the above code is released into the public domain (FWIW), but 
I would appreciate it if you sent any corrections or updates my way.

Tim Massey


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>