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

Introducing the New Documentation

We’re excited to announce the brand new Easy!Appointments Documentation – fully updated, restructured, and easier to navigate than ever before.…

Read Story
automate-your-booking-workflow-illustration

Automate Your Booking Workflow

Easy!Appointments is built to be a powerful and flexible appointment scheduling solution for businesses of all sizes. But what truly…

Read Story
dev-tutorial-add-custom-pages-illustration

Dev Tutorial: Add Custom Pages to Easy!Appointments

Easy!Appointments is a powerful open-source appointment scheduling application built with PHP and the CodeIgniter 3 (CI3) framework. Out of the…

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