x86_64-alpine-sonarr-sidecar/start.sh
Jonny Ervine 3f8078758c modified: start.sh
Trying to get the /config to mount the subPaths
2020-03-16 14:53:37 +00:00

23 lines
843 B
Bash

#!/bin/sh
##
## Script to automate the copy of Sonarr 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/sonarr-ramdisk-mount'
mount /ramdisk/image.ext4 /mnt/sonarr-ramdisk-mount
echo -e 'Copy the config from the remote share to the ramdisk'
cp -fvp /sonarr-config/*.* /mnt/sonarr-ramdisk-mount
echo -e 'Set up the filesystem freeze, copy, unfreeze loop'
while true; do
sleep 890
sync /mnt/sonarr-ramdisk-mount/*.*
fsfreeze --freeze /mnt/sonarr-ramdisk-mount
sleep 10
cp -fvp /mnt/sonarr-ramdisk-mount/*.* /sonarr-config/
fsfreeze --unfreeze /mnt/sonarr-ramdisk-mount
done