#Configuration params
$host = 'localhost';
$user = 'username';
$pass = 'password';
$database = 'dbname';
$backup_dir = '/home/username/backup/db_backup';
$file_prefix = 'database_backup_';
# Get the timestamp for today
$date = `date "+%Y%m%d"`;
chomp($date);
`mysqldump --host=$host --user=$user --pass=$pass $database | bzip2 -c > $backup_dir/$file_prefix$database$date.sql.bz2`;
No comments:
Post a Comment