x86_64-alpine-watcher/sidecar/start.sh
Jonathan Ervine cacd9ca4c2 new file: sidecar/Dockerfile
new file:   sidecar/Jenkinsfile
	new file:   sidecar/start.sh
Added sidecar image to load databases into ramdisk and periodically back
them up
2020-03-19 09:44:25 +08:00

24 lines
860 B
Bash

#!/bin/sh
##
## Script to automate the copy of Watcher databases
##
echo -e 'Starting the sidecar container to periodically backup the sonarr databases'
echo -e 'Create the ramdisk file'
dd if=/dev/zero of=/ramdisk/image.ext4 count=0 bs=1 seek=400M
echo -e 'Create filesystem on ramdisk file'
mkfs.ext4 /ramdisk/image.ext4
echo -e 'Mount the ramdisk file to /mnt/watcher-ramdisk-mount'
mount /ramdisk/image.ext4 /mnt/watcher-ramdisk-mount
echo -e 'Copy the config from the remote share to the ramdisk'
cp -fvp /watcher-config/*.* /mnt/watcher-ramdisk-mount
echo -e 'Set up the filesystem freeze, copy, unfreeze loop'
while true; do
sleep 890
date
sync /mnt/watcher-ramdisk-mount/*.*
fsfreeze --freeze /mnt/watcher-ramdisk-mount
sleep 10
cp -fvp /mnt/watcher-ramdisk-mount/*.* /watcher-config/
fsfreeze --unfreeze /mnt/watcher-ramdisk-mount
done