Commit 6120d163 authored by dmorley's avatar dmorley

backup

parent f1f07933
<?php
include('config.php');
$keep = (60 * 60 * 24) * 3;
$dump_date = date("Ymd_Hs");
$file_name = $backup_dir . "/dump_" . $dump_date . ".sql";
system("export PGPASSWORD=$pgpass && $pg_dump_dir/pg_dump --username=$pguser $pgdb >> $file_name");
$dirh = dir($backup_dir);
while($entry = $dirh->read()) {
$old_file_time = (date("U") - $keep);
$file_created = filectime("$backup_dir/$entry");
if ($file_created < $old_file_time && !is_dir($entry)) {
if(unlink("$backup_dir/$entry")) {
}
}
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment