Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('BACKUP_RSYNC' , 1);
- define('BACKUP_RSYNCAUTH', 2);
- define('BACKUP_SCP', 3);
- /**
- * Perform a backup for the VE.
- * There are different possibilities to perform a backup. The first
- * argument must specify the method to be used. The remaining
- * arguments then depend on the chosen method:
- *
- * - BACKUP_RSYNC - Use rsync: $host
- * - BACKUP_RSYNCAUTH - Use rsync with auth: $host, $user, $password
- * - BACKUP_SCP - Use scp, parameters: $host
- */
- function makeBackup ()
- {
- $args = func_get_args();
- $cmd = '';
- switch ($args[0])
- {
- case BACKUP_RSYNC:
- $cmd = 'rsync' . $args[1];
- break;
- case BACKUP_RSYNCAUTH:
- $cmd = 'rsync --user '.$args[2].' --password '.$args[3].' '.$args[4];
- break;
- // usw...
- }
- exec($cmd);
- }
Add Comment
Please, Sign In to add comment