How to Schedule Server Backups (WIP)
Introduction
A site backup script is run nightly using the wo-scripts script.
Prerequisites
To follow this article, you will need:
- WordOps installed on your server
- WordOps Scripts installed on your server
Schedule a new site for daily backups
SSH into the server.
ssh root@ssh.superrad.dev
Add a new task to the crontab by running the following:
crontab -e
Paste the following to the bottom of the crontab.
# Backup superrad.dev every day at 12am
0 0 * * * /scripts/wo-scripts/wo-backup.sh superrad.dev
If you are using nano
, press ⌃ Control + X, then when prompted, Y and then ⏎ Enter.
Example Cron Jobs
Cron Job | Command |
---|---|
Run Cron Job Every Minute | * * * * * /scripts/wo-scripts/wo-backup.sh newsite.com |
Run Cron Job Every 30 Minutes | 30 * * * * /scripts/wo-scripts/wo-backup.sh newsite.com |
Run Cron Job Every Hour | 0 * * * */scripts/wo-scripts/wo-backup.sh newsite.com |
Run Cron Job Every Day at Midnight | 0 0 * * * /scripts/wo-scripts/wo-backup.sh newsite.com |
Run Cron Job at 2 am Every Day | 0 2 * * * /scripts/wo-scripts/wo-backup.sh newsite.com |
Run Cron Job Every 1st of the Month | 0 0 1 * * /scripts/wo-scripts/wo-backup.sh newsite.com |
Run Cron Job Every 15th of the Month | 0 0 15 * * /scripts/wo-scripts/wo-backup.sh newsite.com |
Run Cron Job on December 1st – Midnight | 0 0 0 12 * /scripts/wo-scripts/wo-backup.sh newsite.com |
Run Cron Job on Saturday at Midnight | 0 0 * * 6 /scripts/wo-scripts/wo-backup.sh newsite.com |
Backups for (7) days
wo-backsup.sh will delete any backup older than 7 days.