How to Create Grav Backups

Date: 09/09/2019 2 Minutes to Read

In this article:

Most content management systems (CMSs) have security and backup plugins available to improve performance and security to your preferences. Grav includes these features natively within the Admin plugin. Similar to cPanel backup scheduling in WebHost Manager (WHM) (for VPS / Dedicated Hosting only), Grav offers options to configure what’s included in backups, different backup configurations with specified schedules, and how many backups to retain at once.

Below we’ll cover how to create Grav backups with the Admin plugin and SSH.

Create a Backup with Grav Admin

Download an up-to-date Grav backup within minutes.

  1. Log in to your Grav Admin plugin.
  2. Click Tools on the left.
  3. At the bottom, modify the settings in the Backup Profiles section.
    NameProfile name for the settings
    Exclude PathsType directory paths to not backup
    Enable Scheduled JobToggle to enable automatic backups
    Root FolderType location for /backups directory
    Exclude FilesType files as needed
    Run Scheduled JobSet timeframe and time to auto-backup if enabled
  4. Click Save at the top.
  5. Click Add item to create a new backup profile if needed.
  6. In the upper-right corner, click the down-arrow beside Backup Now and select your backup profile.
  7. Click the Download icon to the right of the backup under Backup History for local storage.

View scheduled backups as cron jobs in the Scheduler tab. Backups are noted in the Logs section with the Notice level and backup URL.

Grav Admin Plugin Backups Section
Configure Backups with the Admin Plugin

Configure Retention Settings

Grav has three retention options you can choose under Backup Purge Configuration:

Backup Storage Purge TriggerChoose whether to remove backups by maximum backup space, number of backups, or retention time
Maximum Number of BackupsRemoves the oldest backup when set total is reached
Maximum Backups SpaceRemoves the oldest backup when storage limit is reached
Maximum Retention TimeRemoves backups older than set amount of days

Create a Backup in SSH

Users with SSH access can easily create and manage backups with some straight-forward commands. Even users uncomfortable with the command line interface (CLI) should have few issues creating a Grav backup if needed.

  1. Log in to SSH or cPanel Terminal.
  2. Navigate to the Grav directory with the cd command.
  3. Type the command bin/grav backup. You’ll see the prompt below upon completion.

Grav Backup
===========

Archiving 5000 files [=====================] 100% 7 secs Done…

[OK] Backup Successfully Created:
/home/cpaneluser/public_html/grav-subdomain/backup/default_site_backup–20190905201159
.zip

Manage Settings in SSH

Manage backup purge configuration and backup profiles in the system/config/backups.yaml or create the user/config/backups.yaml custom configuration file. Editing backup settings in the Admin plugin will create an user/config/backups.yaml file.

Learn more about Grav CMS in our Support Center.

Leave a Reply