#!/bin/bash
# Run as root

set -x

GITEAUSER=gitea
BACKUPDIR=/srv/BACKUPS
NOW=$( date +%Y%m%d%H%M )

mkdir -p $BACKUPDIR/$NOW
chmod og-rwx $BACKUPDIR/$NOW
chown $GITEAUSER:$GITEAUSER $BACKUPDIR/$NOW
cd $BACKUPDIR/$NOW

sudo -u gitea								\
	nice gitea dump							\
	--config /etc/gitea/gitea.ini					\
	--tempdir $BACKUPDIR/$NOW

