x86_64-alpine-db-sidecar/start.sh
2020-08-17 22:31:12 +08:00

20 lines
672 B
Bash
Executable File

#!/bin/sh
##
## Script to automate the copy of Sonarr databases
##
LIVE_DB=$1
BACKUP_DB=$2
echo -e 'Starting the sidecar container to periodically backup the sonarr databases'
chown 1003:1003 /mnt/app-local-config
chown 1003:1003 /app-remote-config/*
echo -e 'Copy the config from the remote share to the locali drive'
touch /mnt/app-local-config/$LIVE_DB
python3 /app-remote-config/db-restore.py $BACKUP_DB $LIVE_DB
find /app-remote-config/ -type -f -not -iname $BACKUP_DB -exec cp -fvp '{}' '/mnt/app-local-config/{}' ';'
echo -e 'Perform periodic backup of database'
while true; do
sleep 890
date
python3 /app-remote-config/db-backup.py $LIVE_DB $BACKUP_DB
done