Mes scripts de backup
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

32 regels
786 B

<?php
$global_flag = true;
$backup = $argv[1];
$signatures=$backup.'/signatures.sqlite';
if (!is_dir($backup))          die("$backup NOT FOUND !");
if (!file_exists($signatures)) die("$signatures NOT FOUND !");
$connexion = new PDO('sqlite:'.$signatures);
$result = $connexion->query("SELECT sha1, filename, filesize FROM signatures");
if ($result !== FALSE)
  foreach($result as $f)
  {
    $flag    = FALSE;
    $fichier = $backup.'/'.$f['filename'];
    
    if (file_exists($fichier)) $flag = TRUE;
    if (file_exists("$fichier.gz")) $flag = TRUE;
    if (!$flag)
    {
      echo $fichier.' inexistant !'.PHP_EOL;
      $global_flag = FALSE;
    }
  }
$connexion = null;
if ($global_flag) echo "Control signatures OK".PHP_EOL;
else echo "Control signatures NOK".PHP_EOL;
?>