Automate Database Backups

Alex Tselegidis

Regular database backups are essential for protecting your Easy!Appointments installation from data loss due to server crashes, human error, or unexpected issues. Automating this process ensures that you always have a recent copy of your data available without manual effort.

Here’s how you can configure automated database backups for Easy!Appointments:

1. Try the Backup Script

Easy!Appointments already has support for CLI commands that can be triggered from a terminal environment. You can find more info on the available commands by executing the help command.

php index.php console help

In there, you will find that one of the available commands is the backup command, that looks like this.

php index.php console backup

This command will gather and export all the database information inside the storage/backups/ folder on the server, in a gzipped SQL format that can be easily later imported back into a new database.

It is important to make sure that the storage/backups/ folder and contents is not accessible via the web for security reasons.

2. Schedule Automatic Backups with Cron

Set up a cron job to run your backup script at regular intervals (for example, every day at midnight).

Edit your crontab:

crontab -e

Add this line:

0 0 * * * php /path/to/index.php console backup

This will automatically create a backup each night at 12:00 AM.

3. Manage Old Backups

To avoid disk space issues, you can extend your script to delete old backups automatically:

find /path/to/storage/backups -type f -mtime +7 -name "*.gz" -delete

This will remove backups older than 7 days, keeping your backup directory clean and manageable.

4. Store Backups Remotely (Optional)

For extra safety, upload your backups to a remote location such as:

  • A cloud storage service (Google Drive, Dropbox, AWS S3, etc.)
  • A remote server via rsync or scp

This ensures your data remains recoverable even if the server hosting Easy!Appointments is compromised.

5. Test Your Backups

Always test your backups by restoring them to a separate database. This helps verify that your backups are working properly and can be used for recovery when needed.


Going Premium

Did you read this article, but you’re still not sure on how to proceed?

Reach out to info@easyappointments.org and have an expert take care of everything for you in zero time.

Get your free quote and get started now!

More great articles

plesk-logo-banner

How to Install Easy!Appointments With Plesk

The Easy!Appointments installation is pretty simple, and in this post you will learn how to install Easy!Appointments on Plesk. If…

Read Story
new-release-available-illustration

Easy!Appointments 1.5.2 Release

Download A new Easy!Appointments maintenance release is available for download, providing bug fixes and improvements to the previous release. Download…

Read Story
using-custom-booking-fields-illustration

Using the Custom Booking Fields

One of the most powerful features in Easy!Appointments is the ability to add custom fields to your booking form. This…

Read Story

Never miss a minute

Get great content to your inbox every month. No spam.

    Only great content, we don’t share your email with third parties.
    Arrow-up