Example #1
0
    if ($execok == 0) {
        mkdir($opts['budir'] . '/' . $opts['name']);
        //ensure dir structure
        $exec = '/usr/bin/scp -i ' . $opts['remotesshkey'] . ' -c blowfish ' . $user . $opts['remotesshhost'] . ':' . $rbudir[0] . '/backups/' . $opts['name'] . '/' . $opts['now'] . '.tar.gz ' . $opts['budir'] . '/' . $opts['name'];
        exec($exec, $ret);
    }
    //if we have the backup file localy, delete it from the remote server
    if (is_file($opts['budir'] . '/' . $opts['name'] . '/' . $opts['now'] . '.tar.gz')) {
        $exec = '/usr/bin/ssh -o StrictHostKeyChecking=no -i ' . $opts['remotesshkey'] . ' ' . $user . $opts['remotesshhost'];
        $exec .= ' \'dir=' . $rbudir[0] . '/backups/' . $opts['name'] . '; rm -f $dir/' . $opts['now'] . '.tar.gz; if [ ! "$(ls -A $dir)" ]; then rmdir $dir; fi\'';
        exec($exec, $ret);
    }
    if ($opts['remoterestore'] == 'yes') {
        //restore to local machine if requested
        include_once $amp_conf['AMPWEBROOT'] . '/admin/modules/backup/functions.inc.php';
        @backup_restore_tar($opts['budir'] . '/' . $opts['name'] . '/' . $opts['now'] . '.tar.gz', $opts['now'] . '.tar.gz', 'ALL');
    }
} else {
    //otherwise, run it localy
    system('/bin/rm -rf /tmp/ampbackups.' . $opts['now'] . ' > /dev/null  2>&1');
    //remove stale backup
    system('/bin/mkdir /tmp/ampbackups.' . $opts['now'] . ' > /dev/null  2>&1');
    //create directory for current backup
    //backup voicmail if requested
    if ($opts['voicemail']) {
        system('/bin/tar -Pcz -f /tmp/ampbackups.' . $opts['now'] . '/voicemail.tar.gz ' . $amp_conf['ASTSPOOLDIR'] . '/voicemail');
    }
    //backup recordings in requested
    if ($opts['recordings']) {
        system('/bin/tar -Pcz -f /tmp/ampbackups.' . $opts['now'] . '/recordings.tar.gz ' . $amp_conf['ASTVARLIBDIR'] . '/sounds/custom');
    }
Example #2
0
            $backup_parms['name'] = 'backup' . rand(00, 999);
        }
        //handel missing names gracefully
        backup_save_schedule(backup_get_string($backup_parms));
        break;
    case "delete":
        backup_delete_set($id);
        break;
    case "deletedataset":
        exec("/bin/rm -rf '{$dir}'");
        break;
    case "deletefileset":
        exec("/bin/rm -rf '{$dir}'");
        break;
    case "restored":
        $message = backup_restore_tar($dir, $file, $filetype, $display);
        // Regenerate all the ASTDB stuff. Note, we need a way to do speedials and other astdb stuff here.
        // TODO: should this be doing a redirect_standard, doesn't that avoid the status result?
        needreload();
        redirect_standard();
        break;
}
?>
</div>
<div class="rnav"><ul>
    <li><a href="config.php?type=<?php 
echo urlencode($type);
?>
&display=<?php 
echo urlencode($display);
?>