modified: Dockerfile

modified:   start.sh
Added loop to start.sh script
This commit is contained in:
Jonathan Ervine 2020-03-16 21:33:06 +08:00
parent b45cc79891
commit fa19940335
2 changed files with 19 additions and 3 deletions

View File

@ -16,8 +16,8 @@ ENV LANG='en_US.UTF-8' \
RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \ RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk -U update && \ apk -U update && \
apk -U upgrade && \ apk -U upgrade && \
apk -U add nfs-utils e2fsprogs && \ apk -U add nfs-utils e2fsprogs util-linux&& \
# rm -rf /tmp/src && \ rm -rf /tmp/src && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
COPY start.sh /usr/local/bin/start.sh COPY start.sh /usr/local/bin/start.sh

View File

@ -3,4 +3,20 @@
## Script to automate the copy of Sonarr databases ## Script to automate the copy of Sonarr databases
## ##
echo -e 'Starting the sidecar container to periodically backup the sonarr databases' echo -e 'Starting the sidecar container to periodically backup the sonarr databases'
sleep 3600 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 /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/*.* /config/
fsfreeze --unfreeze /mnt/sonarr-ramdisk-mount
done