<?php
$BASE_LIB=$_SERVER["BASE_LIB"];
+$BASE_DIR=$_SERVER["BASE_DIR"];
$BASE_DATA=$_SERVER["BASE_DATA"];
$BACULA_USER=$_SERVER["BACULA_USER"];
-global $BASE_DATA, $BASE_LIB, $BACULA_USER;
+global $BASE_DATA, $BASE_LIB, $BACULA_USER, $BASE_DIR;
require_once "$BASE_LIB/lib.php";
function bacula_config()
{
- global $BASE_DATA, $BASE_LIB, $BACULA_USER, $argv;
+ global $BASE_DATA, $BASE_LIB, $BACULA_USER, $argv, $BASE_DIR;
check_init_and_fail($argv[1]);
$changer = $argv[1];
$ntapes = conf_getVal($changer, "ndrives");
$tapeloc = conf_getVal($changer, "drivelocation");
+ $tapesz = conf_getVal($changer, "tapesize");
// TODO: do this bit
// bacula-sd.conf
?>
+-------------------------------- bacula-sd.conf -----------------------------
Autochanger {
Name = <?php echo "$changer\n"?>
- <?php
+<?php
for($i=0; $i<$ntapes; $i++) {
- echo "Device = \"$changer-drive$i\"\n";
+ echo " Device = \"$changer-drive$i\"\n";
}
- ?>
- Changer Command = "/usr/local/bin/vchanger %c %o %S %a %d"
+?>
+ Changer Command = "<?php echo $BASE_DIR."/bin/pbdc-bacula"?> %c %o %S %a %d"
Changer Device = "<?php echo $changer ?>"
}
RemovableMedia = no;
RandomAccess = yes;
}
+
+
<?php
- }
+ }
+?>
+
+
+-------------------------------- bacula-dir.conf -----------------------------
+Storage {
+ Name = <INSERT STORAGE NAME>
+ Address = <ADDRESS OF WHERE SD IS RUNNING>
+ SDPort = 9103
+ Password = "<SD PASSWORD>"
+ Device = <?php echo "\"$changer-drive$i\"\n" ?>
+ Media Type = File
+ Autochanger = yes;
+}
+
+# a pool for our storage
+Pool {
+ Name = <POOL NAME GOES HERE>
+ Pool Type = Backup
+ Recycle = yes # Bacula can automatically recycle Volumes
+ AutoPrune = yes # Prune expired volumes
+ Volume Retention = 50 days # I set this to 50 days, dont ask me why
+ Maximum Volume Bytes = <?php echo "$tapesz"."G"?> # Limit Volume size to something reasonable
+ Maximum Volumes = 1000 # Limit number of Volumes in Pool SET THIS
+}
+
+# add a default job job defs for our pool - modify where necessary
+# i.e. look at the normal jobdefs, or modify that with your backup defs.
+JobDefs {
+ Name = "PBDCJobDefs"
+ Type = Backup
+ Level = Incremental
+ Storage = <INSERT STORAGE NAME>
+ Messages = Standard
+ Pool = <POOL NAME GOES HERE>
+ Priority = 10
+ Write Bootstrap = "/var/lib/bacula/%c.bsr"
+}
+
+
+<?php
+
}
function pbdc_status()
echo "Creating database\n";
$ra = readline("Directory where automount occurs [/changer/]:");
- $rb = readline("Number of drives [1]:");
+ $rb = readline("Number of drives [2]:");
$rc = readline("Size of tapes [20] (in gb):");
$rd = readline("Where to store drive pointers [/var/run/bacula/]:");
if($ra == "") $ra = "/changer/";
- if($rb == "") $rb = 1;
+ if($rb == "") $rb = 2;
if($rc == "") $rc = 20;
if($rd == "") $rd = "/var/run/bacula/";