2020-05-23 00:04:15 +02:00
---
2022-02-10 12:15:23 +01:00
title: Backing up LibreTime
2020-05-23 00:04:15 +02:00
---
2022-02-09 09:37:52 +01:00
:::info
2022-02-10 12:15:23 +01:00
At the moment, there is no script to cleanly restore a LibreTime backup. To restore a LibreTime backup, install a fresh copy, go through the standard setup process, and reupload the backed-up media files.
2022-02-09 09:37:52 +01:00
:::
2020-06-09 18:59:59 +02:00
2022-02-10 12:15:23 +01:00
A backup script is supplied for your convenience in the `utils/` folder of the LibreTime repo.
2020-11-22 04:37:19 +01:00
Run it using:
2020-11-19 17:59:27 +01:00
```
sudo bash libretime-backup.sh # backs up to user's home folder
# or
sudo bash libretime-backup.sh /backupdir/
```
2020-11-22 04:37:19 +01:00
The backup process can be automated with Cron. Simply add the following to the root user's
2020-11-23 19:58:55 +01:00
crontab with `sudo crontab -e` :
2020-11-22 04:37:19 +01:00
```
2020-11-23 19:58:55 +01:00
0 0 1 * * /locationoflibretimerepo/libretime/backup.sh
2020-11-22 04:37:19 +01:00
```
> For more information on how Cron works, check out [this Redhat guide](https://www.redhat.com/sysadmin/automate-linux-tasks-cron).
2021-05-27 16:20:34 +02:00
If you wish to deploy your own backup solution, the following files and folders need to
2020-11-23 19:58:55 +01:00
be backed up.
2020-11-19 17:59:27 +01:00
2020-11-23 19:58:55 +01:00
```
/srv
/airtime
/stor
2021-05-27 15:59:00 +02:00
/imported - Successfully imported media
2020-11-23 19:58:55 +01:00
/organize - A temporary holding place for uploaded media as the importer works
/etc
/airtime
2022-02-10 12:15:23 +01:00
airtime.conf - The main LibreTime configuration
2020-11-23 19:58:55 +01:00
icecast_pass - Holds the password for the Icecast server
liquidsoap.cfg - The main configuration file for Liquidsoap
```
2017-05-16 12:58:18 +02:00
2021-05-27 16:20:34 +02:00
In addition, you should keep a copy of the database current to the backup. The below code
2022-02-10 12:15:23 +01:00
can be used to export the LibreTime database to a file.
2020-11-23 19:58:55 +01:00
```
2021-05-27 16:20:34 +02:00
sudo -u postgres pg_dumpall filename
2020-11-23 19:58:55 +01:00
# or to a zipped archive
sudo -u postgres pg_dumpall | gzip -c > archivename.gz
```
2017-05-16 12:58:18 +02:00
2020-11-15 03:36:14 +01:00
It is recommended to use an incremental backup technique to synchronize
the your LibreTime track library with a backup server regularly. (If
the backup server also contains an LibreTime installation, it should be possible
to switch playout to this second machine relatively quickly, in case of a
hardware failure or other emergency on the production server.)
2022-02-09 11:41:25 +01:00
Two notible backup tools are [rsync ](https://rsync.samba.org/ ) (without version control) and
[rdiff-backup ](https://rdiff-backup.net/ ) (with version control). _rsync_ comes
2020-11-15 03:36:14 +01:00
preinstalled with Ubuntu Server.
2022-02-09 09:37:52 +01:00
:::note
Standard rsync backups, which are used by the backup script, cannot restore files deleted in the backup itself
:::