Thanks for your answer Craig. Archive-host is the instance of my backup
server that takes care of archiving. Anyway, I dug up further I came across
a post about the archiveme.pl but I couldn't find it so I decided to create
my own. It creates an archive request file and runs the command I grabbed
from the CGI interface when an archiving process is running. For all of you
who wish to do the same, here's the cron job and the PHP script. This cron
job needs to be in the backuppc cron table. You can of course change
time/date arguments to suite your needs.
Cron:
1 14 * * 3 /usr/bin/php -q /backups/data/conf/archive.php
PHP:
<?php
$req = "%ArchiveReq = (
'archiveloc' => '/path/to/dest',
'reqTime' => TIME,
'BackupList' => [BACKUPLIST],
'host' => 'archive-host',
'parfile' => '0',
'archtype' => '0',
'compression' => '/path/to/gzip',
'compext' => '.gz',
'HostList' => [HOSTLIST],
'user' => 'user',
'splitsize' => '0000000'
);";
$req = str_replace("TIME",date("U"),$req);
$hlist = array();
$root = "/path/to/data";
$hosts = file("$root/conf/hosts");
$skppied_headers = 0;
$id = 0;
for($i=0;$i<count($hosts);$i++) {
$hosts[$i] = trim($hosts[$i]);
// skip comment lines in hosts file
if($hosts[$i][0] == "#" || strlen($hosts[$i]) < 1) { continue; }
// skip header line in hosts file
if(!$skipped_headers) { $skipped_headers = 1; continue; }
$host_ex = preg_split("/[\s]+/", $hosts[$i]);
$backups_file = "$root/pc/".$host_ex[0]."/backups";
if(file_exists($backups_file)) {
$cmd = "tail -1 $backups_file | awk '{print \$1}'";
$bkpnum = `$cmd`;
$bkpnum = trim($bkpnum);
if(strlen($bkpnum) > 0) {
$blist[] = "'".$bkpnum."'";
$hlist[] = "'".$host_ex[0]."'";
$id += $bkpnum;
}
}
}
$req = str_replace("HOSTLIST",implode(",",$hlist),$req);
$req = str_replace("BACKUPLIST",implode(",",$blist),$req);
$outfile = "archiveReq.$id.0";
$fp = fopen("$root/pc/archive-host/$outfile","w");
fwrite($fp,$req);
fclose($fp);
`/backups/bin/BackupPC_archive archive-host $outfile`;
?>
Regards,
Christophe Faribault
Systems Administrator
Webstorm Media Inc.
[EMAIL PROTECTED]
(514) 392-7722 x233
-----Original Message-----
From: Craig Barratt [mailto:[EMAIL PROTECTED]
Sent: August 30, 2005 08:54
To: Christophe Faribault
Cc: [email protected]
Subject: Re: [BackupPC-users] RE: Cron job to start archive host
"Christophe Faribault" writes:
> /backups/bin/BackupPC_archiveHost /backups/bin/BackupPC_tarCreate
> /usr/bin/split /usr/bin/par2 archive-host -1 /bin/gzip .gz 0
> /mnt/exthd 0 "*"
>
> But I get this when I run it:
>
> Writing tar archive for host archive-archive, backup #-1 to output
> file /mnt/exthd/archive-host.-1.tar.gz
> /backups/bin/BackupPC_tarCreate: bad backup number -1 for host
> archive-host
I assume it really said "host archive-host" not "host archive-archive"?
Normally the backup number argument should be >= 0. But BackupPC_tarCreate
takes -1 to mean the last backup. So what you tried should work.
The only explanations I can propose is that the host archive-host doesn't
have any backups, or you didn't run the command as the backuppc user
(meaning it didn't have permission to read the backups file).
Craig
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
BackupPC-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/