# Backup and restoration of Mautic

**URL:** <https://forum.mautic.org/t/backup-and-restoration-of-mautic/16062>\
**Category:** Product Support\
**Created:** [September 12, 2020, 11:05pm UTC](https://forum.mautic.org/t/backup-and-restoration-of-mautic/16062 "2020-09-12T23:05:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmed](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ahmed/32/798_2.png) [@ahmed](https://forum.mautic.org/u/ahmed)\
**Post date:** [September 12, 2020, 11:05pm UTC](https://forum.mautic.org/t/backup-and-restoration-of-mautic/16062/1 "2020-09-12T23:05:57Z")

</div>

Hello!

I am a beginner in IT and Web Development.  
I would like to create a backup of the Mautic installed on a hosting server “A” and restore it in another server “B”. How do I do that?  
If it’s possible to automate the backup and the restoration, please tell me how to proceed.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [September 13, 2020, 6:27am UTC](https://forum.mautic.org/t/backup-and-restoration-of-mautic/16062/2 "2020-09-13T06:27:04Z")

</div>

Hello Ahmed!  
Mautic backup is no different than any other software backup, that is installed on a web server.  
Zip the folder + backup DB and move it. (make sure domain settings are okay.)  
If you want to do it on a larger scale, look into:

> **[Segmentation and Large-Scale Mautic Deployment](https://www.meetup.com/Mautic-Meetup-Lagos/events/272511292/)**
>
> Sat, Aug 29, 2020, 11:00 AM: We are having two amazing seasoned speakers joining us this month Yosu and Kevin.Yosu Cadilla is a Mautic and email deliverability freelancer that have deployed Mautic for

Good luck  
Joey

---

<div class="post-metadata">

**Author:** ![jimkey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jimkey/32/3317_2.png) [@jimkey](https://forum.mautic.org/u/jimkey)\
**Post date:** [September 13, 2020, 7:55pm UTC](https://forum.mautic.org/t/backup-and-restoration-of-mautic/16062/3 "2020-09-13T19:55:46Z")

</div>

I would add to bring over the crontab jobs, too.  
crontab -l  
copy and paste it to a text file and reimport it on new server.

---

<div class="post-metadata">

**Author:** ![ahmed](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ahmed/32/798_2.png) [@ahmed](https://forum.mautic.org/u/ahmed)\
**Post date:** [September 13, 2020, 8:23pm UTC](https://forum.mautic.org/t/backup-and-restoration-of-mautic/16062/4 "2020-09-13T20:23:34Z")

</div>

Hello @joeyk and thank you for your reply!

The problem is that I have never performed a backup of a web software.  
How do I zip the mautic folder (home/public\_html/mautic)?  
For the database backup, I suppose that I only need to use the backup wizard of my control panel. Is there a way to automate it?

---

<div class="post-metadata">

**Author:** ![ahmed](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ahmed/32/798_2.png) [@ahmed](https://forum.mautic.org/u/ahmed)\
**Post date:** [September 13, 2020, 8:28pm UTC](https://forum.mautic.org/t/backup-and-restoration-of-mautic/16062/5 "2020-09-13T20:28:36Z")

</div>

Hi @jimkey and thanks for replying!

What should I copy and paste?  
If you know any cron jobs to automate the backup of Mautic, please inform me what they are.  
If there is a way to automate the restoration to another server periodically, that would be even better!

---

<div class="post-metadata">

**Author:** ![jimkey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jimkey/32/3317_2.png) [@jimkey](https://forum.mautic.org/u/jimkey)\
**Post date:** [September 14, 2020, 1:38am UTC](https://forum.mautic.org/t/backup-and-restoration-of-mautic/16062/6 "2020-09-14T01:38:28Z")

</div>

ahmed,

We can only give you examples. You need to learn Linux System Administrations especially command line tools cp, tar, rsync, ssh, crontab, mysql, and mysqldump.

Here are some snippets from my backup bash script below. A keep a week or 2 of backups on the server. I’m on AWS so copy my /backups contents to a S3 bucket and a 2nd server.  
If you not on AWS, you can use rsync to sync your backup folder to another server.

For restoration, you would restore the apache/nginx config files, restore the mautic folder, and restore the mysql database, and change the DNS to point to your new server.

# purge old daily and weekly backups after mtime days.

find $backuppath -type f -mtime +5 -name ‘daily\*’ -execdir rm – ‘{}’ ;

# backup the mautic folder, assets, and dump mysql database.

tar -zcvf “${backuppath}daily-mautic-datename.tar.gz" /opt/mautic-3.0.2-0/apps/mautic/ tar -zcvf "{backuppath}daily-mautic-assets-datename.tar.gz" /opt/mautic-3.0.2-0/apps/mautic/assets /opt/mautic-3.0.2-0/mysql/bin/mysqldump --no-tablespaces -u bn\_mautic -pxx bitnami\_mautic | gzip -c \> "{backuppath}daily-$sitename1.sql-$datename.gz”

# sync or you can rsysnc to offline

aws s3 sync /backup/ji-email s3://s3bucket.xx.com/30days/ji-email

---

<div class="post-metadata">

**Author:** ![tobsowo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/tobsowo/32/3096_2.png) [@tobsowo](https://forum.mautic.org/u/tobsowo)\
**Post date:** [April 3, 2023, 7:21am UTC](https://forum.mautic.org/t/backup-and-restoration-of-mautic/16062/7 "2023-04-03T07:21:38Z")

</div>

Hello @jimkey thank you for sharing, do you in any way a full script of this for rsync or rclone which ever works best?
