sql backup with php
exec("mysqldump -udbuser1 -p12345 --databases db1 db2 > /home/user1/dbbackup-".date('Y-m-d').".sql");
exec("tar -zcvf /home/user1/dbbackup-".date('Y-m-d').".tar.gz /home/user1/dbbackup-".date('Y-m-d').".sql");
unlink("/home/user1/dbbackup-".date('Y-m-d').".sql");
@unlink("/home/user1/dbbackup-".date('Y-m-d', strtotime("now -3 days")).".tar.gz");
exec("s3cmd put /home/user1/dbbackup-".date('Y-m-d').".tar.gz s3://database-backups");
mysqldump ---user admin ---password=password mydatabase > sql.dump
crontab -e
/* backup every day at 00:00:00 */
0 0 * * * mysqldump -u root -ppassword YOUR_DATABASE > /backup/YOUR_DATABASE.sql
auto srat apache
sudo /sbin/chkconfig --levels 235 httpd on
sudo service httpd start
No comments:
Post a Comment