Simple shell script to backup your cpanel Public_html directory including your mysql database in cPanel using cron.
- your_cPanel_username : Your cPanel user name.
- MySQL_username : Your MySQL username for the database linked with your WebApp.
- MySQL_Dbname : Name of the database you want to backup.
- In “YourName_Backup_$STAMP.tar.gz” change “YourName_Backup” to your preferred backup name for the backup file.
- Create a folder named “backups” outside Public_html/ folder.[Note: name backups is preferred , or change it in script in DEST if you want a different name]
- Place the script inside the folder “backups”.
- Set up the cron job and add your preferred time to run the script in cronjob. Here is a nice guide on adding script to cronjob https://documentation.cpanel.net/display/ALD/Cron+Jobs.