# Triggering Backups

**URL:** <https://community.open-emr.org/t/triggering-backups/15440>\
**Category:** Management and Administration\
**Created:** [November 7, 2020, 4:54am UTC](https://community.open-emr.org/t/triggering-backups/15440 "2020-11-07T04:54:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jesdynf](https://community.open-emr.org/user_avatar/community.open-emr.org/jesdynf/32/15698_2.png) [@jesdynf](https://community.open-emr.org/u/jesdynf)\
**Post date:** [November 7, 2020, 4:54am UTC](https://community.open-emr.org/t/triggering-backups/15440/1 "2020-11-07T04:54:24Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![growlingflea](https://community.open-emr.org/user_avatar/community.open-emr.org/growlingflea/32/15498_2.png) [@growlingflea](https://community.open-emr.org/u/growlingflea)\
**Post date:** [November 7, 2020, 5:44am UTC](https://community.open-emr.org/t/triggering-backups/15440/2 "2020-11-07T05:44:28Z")

</div>

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](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/3/30afb3436a9bbd496b5c71ebbc21014d014dc440.png)

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

Step 1:

![image](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/4/48a896da2a60c1ed1756501ac7ed5e8d1d50ec5a.png)

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:

 ![image](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/1/115aa033d60e5bb445f5aab0c5160d2cd24434d8.png)

The contents of the file looks something like this:

 ![image](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/f/f821c75759c808b2c298f48cdc0523f99b7c47c4.png)

---

<div class="post-metadata">

**Author:** ![jesdynf](https://community.open-emr.org/user_avatar/community.open-emr.org/jesdynf/32/15698_2.png) [@jesdynf](https://community.open-emr.org/u/jesdynf)\
**Post date:** [November 7, 2020, 4:27pm UTC](https://community.open-emr.org/t/triggering-backups/15440/3 "2020-11-07T16:27:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![growlingflea](https://community.open-emr.org/user_avatar/community.open-emr.org/growlingflea/32/15498_2.png) [@growlingflea](https://community.open-emr.org/u/growlingflea)\
**Post date:** [November 9, 2020, 2:36am UTC](https://community.open-emr.org/t/triggering-backups/15440/4 "2020-11-09T02:36:15Z")

</div>

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.
