From 532c64872559bb76a9c8e44b68d7560af552acdc Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Mon, 23 Mar 2020 13:25:09 +0800 Subject: [PATCH] modified: start.sh Changed from ramdisk to use a local emptyDir --- start.sh | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/start.sh b/start.sh index 818618f..a6bed73 100644 --- a/start.sh +++ b/start.sh @@ -1,23 +1,18 @@ #!/bin/sh ## -## Script to automate the copy of databases running on a ramdisk to a permanent storage location +## Script to automate the copy of Sonarr databases ## -echo -e 'Starting the sidecar container to periodically backup the 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/db-ramdisk-config' -mount /ramdisk/image.ext4 /mnt/db-ramdisk-config -echo -e 'Initial copy of the config from the remote share to the ramdisk' -cp -fvp /perm-config/*.* /mnt/db-ramdisk-config +echo -e 'Starting the sidecar container to periodically backup the sonarr databases' +chown 1003:1003 /mnt/app-local-config +echo -e 'Copy the config from the remote share to the ramdisk' +cp -fvp /app-remote-config/*.* /mnt/app-local-config echo -e 'Set up the filesystem freeze, copy, unfreeze loop' while true; do sleep 890 date - sync /mnt/db-ramdisk-config/*.* - fsfreeze --freeze /mnt/db-ramdisk-config + sync /mnt/app-local-config/config/*.* + fsfreeze --freeze /mnt/app-local-config sleep 10 - cp -fvp /mnt/db-ramdisk-config/*.* /perm-config/ - fsfreeze --unfreeze /mnt/db-ramdisk-config + cp -fvp /mnt/app-local-config/*.* /app-remote-config/ + fsfreeze --unfreeze /mnt/app-local-config done