# Help with a backup

**URL:** https://forum.pritunl.com/t/help-with-a-backup/1242
**Category:** Pritunl VPN
**Created:** [July 21, 2023, 8:19am UTC](https://forum.pritunl.com/t/help-with-a-backup/1242 "2023-07-21T08:19:26Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![cristian](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@cristian](https://forum.pritunl.com/u/cristian)
#### Post date: [July 21, 2023, 8:19am UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/1 "2023-07-21T08:19:26Z")

</div>

Hi, I have installed a pritunl server (ver. enterprise) in which I have configured multiple servers. For security reasons I have created a script that uses crontab to make a backup copy of mongodb on a daily basis.

All this happens regularly but it often happens that I find the servers active but all the clients disconnected (or partially) as well as no longer being able to establish new connections and I am contracted to perform a stop & start of all the servers present via the web and only in this way does everything work again.

What can I add or change to my script so that this doesn’t happen again?

This is the content of the script:

**sudo service pritunl stop**  
**mongodump -d pritunl -o pritunl-bkp**  
**tar -czvf pritunl-bkp.tar.gz pritunl-bkp**

Thank you

---

<div class="post-metadata">

### Author: ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)
#### Post date: [July 24, 2023, 7:08pm UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/2 "2023-07-24T19:08:10Z")

</div>

The Pritunl service doesn’t need to be stopped to backup the database, that will disrupt connections. The file `/var/lib/pritunl/pritunl.uuid` should be included in the backup. This file is the host ID that identifies the host in a cluster.

---

<div class="post-metadata">

### Author: ![cristian](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@cristian](https://forum.pritunl.com/u/cristian)
#### Post date: [July 26, 2023, 5:37am UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/3 "2023-07-26T05:37:55Z")

</div>

In the meantime, thank you for answering me. can you give me an example of how to write the script with integration of this file?

---

<div class="post-metadata">

### Author: ![drhackenbush](https://forum.pritunl.com/user_avatar/forum.pritunl.com/drhackenbush/32/511_2.png) [@drhackenbush](https://forum.pritunl.com/u/drhackenbush)
#### Post date: [July 27, 2023, 11:49am UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/4 "2023-07-27T11:49:53Z")

</div>

In the last line of your script, include that file into the tar archive you create:

```auto
tar czvf pritunl-bkp.tar.gz pritunl-bkp /var/lib/pritunl/pritunl.uuid

```

---

<div class="post-metadata">

### Author: ![cristian](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@cristian](https://forum.pritunl.com/u/cristian)
#### Post date: [July 28, 2023, 7:23pm UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/5 "2023-07-28T19:23:01Z")

</div>

OK thank you. but a curiosity what does this file contain?

---

<div class="post-metadata">

### Author: ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)
#### Post date: [July 29, 2023, 2:48am UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/6 "2023-07-29T02:48:39Z")

</div>

The uuid file contains the host ID that identifies the host in the cluster. If an enterprise subscription is configured the hosts are shown in the web console. If the host ID is not restored a new host is created and it will need to be re-attached to the servers. If there is no enterprise subscription the single host will automatically attached to all servers.

---

<div class="post-metadata">

### Author: ![cristian](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@cristian](https://forum.pritunl.com/u/cristian)
#### Post date: [July 30, 2023, 10:56am UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/7 "2023-07-30T10:56:26Z")

</div>

perfect it’s clear but the thing I don’t understand is that this can be useful in the case of a backup restore but for me the problem occurs when the backup has just been performed.

anyway can you give me an example of how to integrate the file into the backup script?

---

<div class="post-metadata">

### Author: ![cristian](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@cristian](https://forum.pritunl.com/u/cristian)
#### Post date: [August 17, 2023, 5:33am UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/8 "2023-08-17T05:33:54Z")

</div>

Up please?

---

<div class="post-metadata">

### Author: ![cristian](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@cristian](https://forum.pritunl.com/u/cristian)
#### Post date: [August 29, 2023, 3:04am UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/9 "2023-08-29T03:04:14Z")

</div>

Where is a complete command for restore with “/var/lib/pritunl/pritunl.uuid” ?

---

<div class="post-metadata">

### Author: ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)
#### Post date: [August 29, 2023, 9:31pm UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/10 "2023-08-29T21:31:39Z")

</div>

No command needs to be run, it’s a file with an ID. The file needs to contain the ID and the server can be started with `sudo systemctl start pritunl`.

---

<div class="post-metadata">

### Author: ![cristian](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@cristian](https://forum.pritunl.com/u/cristian)
#### Post date: [August 30, 2023, 6:38am UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/11 "2023-08-30T06:38:52Z")

</div>

> [@drhackenbush](#):
>
> `tar czvf pritunl-bkp.tar.gz pritunl-bkp /var/lib/pritunl/pritunl.uuid`

Yes ok but I was wondering when you run the command “tar czvf pritunl-bkp.tar.gz pritunl-bkp /var/lib/pritunl/pritunl.uuid” this uuid file is also put in the bkp.tar.gz or else (as indicated in the suggested line) will it be executed after the tar.gz has been created?

---

<div class="post-metadata">

### Author: ![drhackenbush](https://forum.pritunl.com/user_avatar/forum.pritunl.com/drhackenbush/32/511_2.png) [@drhackenbush](https://forum.pritunl.com/u/drhackenbush)
#### Post date: [September 21, 2023, 12:28pm UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/12 "2023-09-21T12:28:11Z")

</div>

I’m not sure I understand. Why do you think the command I’ve posted will try to execute the UUID file?  
That’s not how unix works. What we are doing here is just: ‘program arg1 arg2 arg3… argN’. So basically ‘tar’ is the program here, and everything else is passed as arguments to ‘tar’.

And now check out the manual page for tar. The syntax for creating archive allows specifying multiple paths to be included in the archive. And that’s what that command is doing. Yes, the uuid file will be the part of the archive.

---

<div class="post-metadata">

### Author: ![cristian](https://forum.pritunl.com/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@cristian](https://forum.pritunl.com/u/cristian)
#### Post date: [September 21, 2023, 12:48pm UTC](https://forum.pritunl.com/t/help-with-a-backup/1242/13 "2023-09-21T12:48:12Z")

</div>

Ok it’s clear now, so it will also be inserted into the tar.gz archive and will automatically return to its original position when it is decompressed.
