script para realizar backup programados en Plesk

Espero que os sirva de ayuda este script en php que me he encontrado en un foro privado para realizar respaldos programados en Plesk, aqui se los copypasteo:

<?php

$maintain = 3; // Cuantos respaldos conservar
$prefix = “plesk”;
$path = “/mnt/backup/”; //dont delete slash

set_time_limit(0);

$day = date(“d”);
$month = date(“m”);
$year = date(“y”);

$backupfile = “$prefix$day$month$year”;

$comando = “/usr/local/psa/bin/pleskbackup all $path$backupfile”;
@exec($comando);

$unixtime = mktime(0,0,0,$month, $day, $year); // present time
$todelete = $unixtime – ($maintain *= 86400);

// create file name to delete
$day_d = date(“d”, $todelete);
$month_d = date(“m”, $todelete);
$year_d = date(“y”, $todelete);

$backupdel = “$prefix$day_d$month_d$year_d”;

if (@file_exists(“$path$backupdel”)) {
@exec(“rm -f $path$backupdel”); // Delete file
}

?>