Backup script

Hi,
I was wondering if someone has a backup script to share for a PeerTube server.
It might detect and save only the best quality videos, thumbnails, .torrent files… and save the database.

Thanks!

The upgrade script is already doing a backup database, might be a good starting point :wink:

I don’t know if it works for you but I just did a very simple script to make the full copy of ubuntu 18.04 (Armbian) after backing up the PeerTube database.

I copy it down here in case you need it as a starting point.

#!/bin/bash

DATE=$(date +"%Y-%m-%d_%H:%M")

# Backup PeerTube sql db
sudo -u postgres pg_dump peertube_prod \
> /BackUP/"$DATE"_peertube_prod.sql

# Backup all System
cd /
tar -cvpzf /BackUP/"$DATE"_System.tar.gz \
--exclude=/BackUP/*_backup.tar.gz \
--exclude=/BackUP \
--exclude=/proc \
--exclude=/tmp \
--exclude=/mnt \
--exclude=/dev \
--exclude=/sys \
--exclude=/run \
--exclude=/media \
--exclude=/opt \
--exclude=/lost+found \
--exclude=/var/log \
--exclude=/var/cache/apt/archives \
--exclude=/usr/src/linux-headers* \
--exclude=/home/*/.gvfs \
--exclude=/home/*/.cache \
--exclude=/Core* \
--exclude=/home/*/.local/share/Trash /