I'm looking for help on writing a script in Linux and I will outline what I want to do with it below.
I would like the script to:
1- execute a backup of this database
mysqldump -uusername -ppassword databasename > sqldump.sql
2- rename the file so that the current date and time are placed at the end of the file. date formate to be Year/month/day/time (unless a better format should be used)
rn sqldump.sql phpbb2$current_date.sql
3- gzip the file
gzip -9 *.sql
4- move the file to a specific location and not leave anything remaining.
5- check for the last 5 backups and delete any remaining so that only the 5 most recent backups exist in this given directory including the newest file to be copied over.
I would then guess a Cron job could execute this script on a schedule, therefore creating an automated backup of the database into a specific location.
Does anyone know how to do this? Any advice appreciated.
-Doug
I would like the script to:
1- execute a backup of this database
mysqldump -uusername -ppassword databasename > sqldump.sql
2- rename the file so that the current date and time are placed at the end of the file. date formate to be Year/month/day/time (unless a better format should be used)
rn sqldump.sql phpbb2$current_date.sql
3- gzip the file
gzip -9 *.sql
4- move the file to a specific location and not leave anything remaining.
5- check for the last 5 backups and delete any remaining so that only the 5 most recent backups exist in this given directory including the newest file to be copied over.
I would then guess a Cron job could execute this script on a schedule, therefore creating an automated backup of the database into a specific location.
Does anyone know how to do this? Any advice appreciated.
-Doug