Onsite clients may request for automated backup scripts to be deployed on their servers for daily backups.
Use:
Deploy the below script on the clients server along with a specific cron-task setup for backups to be taken on a pre-defined time everyday.
Important Points to Consider:
The following script has been tested locally, but when you deploy on a clients environment make sure to test this again before adding into the live environment.
A parameter (days) is defined where you can pass an integer, this will be used as a trigger point to remove backups that are old. I.E. if you set the days as 10, it will remove all backups which are 10 days older.
A log file is maintained to log if a backup is completed/failed (you will have to define the path when deploying).
Inform the clients on the below:
OrangeHRM will not be liable for any backups as we are only doing this as a help for the client but this is not our responsibility.
If the backups are stored in the same server, client needs to make sure they move the backups to another location from time to time.
Change the following parameters as desired in the Clients' Environment;
MYSQL_ROOT - MySQL Root Password
LOCAL_HOST - DB Local Host
dateStamp - Parameter to store Today's Date
dbName - DB Name
backupName - DB Backup Name (dataStamp and dbName parameters above need to have values first)
backupPath - Path in which the Backup will be stored
days - Flag set to remove the backups after the define days are elapsed, this is done to remove older backups.
A parameter on the mysqldump command has been hard-coded, please make sure to update this value with the actual DB Name on the (sed 's/`tmp_db`\.//g') section.
Cron-Task Example:
0 23 * * * cd /path/to/script/ && sh script_name.sh > /dev/null