Here is the scenario I do every day
- log into my machine as root
- rename file1.htm to file2.htm
- rename file3.htm to file1.htm
- rename folder main to secondary
- run command: mysqldump database_name | gzip -c > /home/backups/backup_date.sql.gz
the mysqldump command normally takes 5 minutes, once finished, continue
- run command: service mysql restart
- rename folder secondary to main
- rename file1.htm to file3.htm
- rename file2.htm to file1.htm
How to automate these steps to run everyday at specific time. I know it can be done through cron job, but I think I should first put all these commands into a file which will be run by the cron job.
Please note that the rename of the two files and folder is a MUST, and also the "backup_date.sql.gz" file should have different date everytime it is created, so the word "date" should be replaced by the current date (e.g. 03Aug2007, or 04Aug2007 for tom.), so the output file should look like: backup_03Aug2007.sql.gz
Any help with this!