It was time to deploy the project into the production server. Almost everything is complete. The pages are running smoothly, the scheduler for current weather forecast and the database is fully optimized.
One lacking is the daily database backup. I decided it to be daily since it is not that critical, so here is my script for the daily MySQL Backup.
1
2
3
4
5
| #!/bin/bash filename= 'db_name' date =` date +%Y-%m-%d-%H-%M-%S` backup= "/home/user/test_db_backup/$filename.$date.gz" mysqldump rani -u db_user -pthePassw0rd | gzip -c > $backup |
It simply backs up the database using mysqldump utility, and pipe it to gzip utility to compress the file and finally saves into the backup path. By the way it uses the current date and time appended to the filename.
No comments:
Post a Comment