Skip to main content

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:

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 JobCommand
Run Cron Job Every Minute* * * * * /scripts/wo-scripts/wo-backup.sh newsite.com
Run Cron Job Every 30 Minutes30 * * * * /scripts/wo-scripts/wo-backup.sh newsite.com
Run Cron Job Every Hour0 * * * */scripts/wo-scripts/wo-backup.sh newsite.com
Run Cron Job Every Day at Midnight0 0 * * * /scripts/wo-scripts/wo-backup.sh newsite.com
Run Cron Job at 2 am Every Day0 2 * * * /scripts/wo-scripts/wo-backup.sh newsite.com
Run Cron Job Every 1st of the Month0 0 1 * * /scripts/wo-scripts/wo-backup.sh newsite.com
Run Cron Job Every 15th of the Month0 0 15 * * /scripts/wo-scripts/wo-backup.sh newsite.com
Run Cron Job on December 1st – Midnight0 0 0 12 * /scripts/wo-scripts/wo-backup.sh newsite.com
Run Cron Job on Saturday at Midnight0 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.