Do you use or administer OpenEMR? Take the General Satisfaction Survey to help improve the product

Triggering Backups

Hi,

Do we (or can we) have any provisions to start a backup from the command line? It would be super-useful if I could manage one with a cronjob – run the backup template from a script, grab the output, hustle it somewhere or other.

Importing the backup via command-line would also be amazing, but I acknowledge it might be pushing my luck.

Thanks!

Yes. mysqldump will dump the database into a file. You can then save it to an external drive or store the backup on an Amazon S3 instance.

You can set up a cronjob that does a sqldump on a normal basis.

image

If you are on a linux machine, you can set up a cronjob.

Step 1:

image

This will open a screen where you can set up the cronjob. Here I call a bash script that I wrote that calls the mysqldump command:

The contents of the file looks something like this:

Thanks, Daniel, but that’s not quite what I meant. OpenEMR has an internal backup facility, or at least I understood that it does, that creates tarballs containing the patient records and documents. That’s what I meant to try to get access to.

Ah, I see. What I’ve done in the past was have an S3 storage and run a cron job that rsyncs the site/default folder nightly. You don’t have to use S3 but any external drive will do.