PHP ile dosya ve db backup

10 Jun
2013


";
}
else{
echo "Directory can't created
";
}
}
else{
echo "Directory already exists
";
}
$archname = $path.'/'.$domainName.'_files_' . date("Y-m-d-H-i-s") . '.tar.gz';

$command .= 'tar -cvj ./* | split -b 15m -d - "' . $archname . '."';
/*
$command = 'tar -';
$command .= '-exclude ' . $archname . ' -czf ' . $archname . ' .';
*/
$output = shell_exec($command);
echo $command;
//$output = shell_exec($command);
echo $output.'
';
//$size = round(filesize($archname)/1000);

echo "File backup finished
";// size: ".$size."
";
echo "Database backup started
";

$backupFile = $path.'/'.$domainName.'_db_' . date("Y-m-d-H-i-s") . '.tar.gz';
$command = "mysqldump --opt -h localhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";
shell_exec($command);
echo "Database backup finished
";

?>

Be Sociable, Share!

Comment Form

top