Backup Feature Request

On the siteworx backups, please add an extra field like “Max Count to Keep” so that it will delete older backups.

Had a customer today with 480 backups of their site. Not too good!

Definitely not good! We’ll get this added asap.

Paul

thanks Paul! that would be super groovy.

[QUOTE=marco114;17488]On the siteworx backups, please add an extra field like “Max Count to Keep” so that it will delete older backups.

Had a customer today with 480 backups of their site. Not too good![/QUOTE]
While I was hosted with iworx panel, I used a PHP script to delete old files and put it in a daily cron to have last X backups.


<?
function ml($sub, $msg='')
{
  if ($msg == '')
    $msg = $sub;
  mail('myself@example.com', $sub, $msg);
}

function DeleteOldFiles($wild, $tokeep, $path='')
{
  if ($path == '')
    $files = glob($wild);
  else {
    if ( substr($path, -1, 1) != '/' ) // doesn't end with a slash
      $path .= '/';
    $files = glob($path . $wild);
  }
  if (!$files) {
    $n = count($files);
    ml("glob failed: $n elements", "glob failed: $files");
    return;
  }

  usort($files, "cmp");

  $todel = count($files) - $tokeep;
  for ($i = 0; $i < $todel; $i++) {
    unlink($files[$i]);
    //ml("deleted file $i", "$files[$i]");
  }
}

function cmp($a, $b)
{
  $sa = filemtime($a);
  $sb = filemtime($b);
  if ($sa == $sb)
    return 0;
  return ($sa < $sb) ? -1 : 1;
}
?>


<?

require '../../my/delold.inc';
DeleteOldFiles("mydomain.com-partial-*.tgz", 1, '/home/mydomain/mydomain.com/iworx-backup');

?>

I remember I also wrote a script that copies the current backup to a public folder of my site (and another script to delete it) and I call that ‘copy’ script from a windows batch file, then download the backup file, and then call the delete script (all using wget). This way I had my recent backup in my local system and its an offsite backup. (there is no point in having a backup on the same machine although it may help in situation like accidental file deletions)

The only security issue with this is your backup is available in public access, but it is only for a short period (until your download of backup file completes) so I made the download file’s name different each time (and the public folder isn’t accessible via browser). If iworx supports encryption of the tar.gz file, then it would be safe I think (iworx may also support the option to keep the encrypted backup in a public folder; thereby avoiding the need of scripts to copy, download and then delete; the recent backup is always available for download)

So, this (encrypted backup) may be another feature request?