[contact-form-7 id=”4740″ title=”Call me”]
For WordPress sites, I recommend UpDraft Plus and use it on all my client’s sites flawlessly.
However, for non-Wordpress sites, your hosting company might provide a daily or weekly backup as part of your hosting package.
Regardless, it’s best practice to setup a secondary backup system that will keep multiple copies of your database (if applicable) and files.
Screenshots are from a Site5 control panel
TIP: The cron environment is different than the SSH environment and “#” / “%” characters are interpreted as a comment character. In order to solve this matter, you will need to escape each “%” with a backslash. (Thanks Florin M.)
Objective: Add a CRON job to create a Tar Gzip file that will use the current date and time in the file’s name. This file will also be saved in a folder called “FILES-backup”.
This command will tar all files in the public_html folder and create an archive in the FILES-backup folder using today’s date/time.
tar -zcf FILES-backup/"$(date '+\%m-\%d-\%y').tar.gz" public_html
Objective: Add a CRON job to create a SQL file that will use the current date and time in the file’s name. This SQL file will be saved in a folder called “DB-backup”.
This command will dump a MYSQL database in the FILES-backup folder using today’s date/time.
mysqldump -u Jimmy -pJimmyPW JimmyDB > DB-backups/$(date +\%m-\%d-\%Y-\%H.\%M.\%S)-JIMMY-db.sql
In this example, your hosting username and password (usually same login as your Cpanel or web hosting) is Jimmy / JimmyPW,
and your database name is JimmyDB, and the resulting file will be saved in the DB-backups folder.
NOW go back that thang up!!
I’ll revise this post later to add commands to only keep certain date ranges.