diff options
author | Simon Rettberg | 2023-05-08 11:51:58 +0200 |
---|---|---|
committer | Simon Rettberg | 2023-05-08 11:51:58 +0200 |
commit | cdeb8df04e2abd67f3ed68b8500d8dad1dbd7c43 (patch) | |
tree | a1d136069a5be7c88e7f36bcb2f84e7ee28bfeac /core/modules/dnbd3-proxy-mode | |
parent | [lightdm-greeter-bwlp/xorg] Fix: lightdm restarts on failed auth (diff) | |
download | mltk-cdeb8df04e2abd67f3ed68b8500d8dad1dbd7c43.tar.gz mltk-cdeb8df04e2abd67f3ed68b8500d8dad1dbd7c43.tar.xz mltk-cdeb8df04e2abd67f3ed68b8500d8dad1dbd7c43.zip |
[dnbd3-proxy-mode] Dynamic deletion delay based on RTC
If the proxy is being started up mid-day, it might be undesired to have
it wait for 18 hours before deleting old images. This might mean we
don't have a good idea which image has been unused longest, but it's
better to delete *some* unused image than just not replicating any
images at all.
Diffstat (limited to 'core/modules/dnbd3-proxy-mode')
-rwxr-xr-x | core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy index 04cc9ba4..96d62ae4 100755 --- a/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy +++ b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy @@ -160,7 +160,19 @@ else DNBD3_BGR="false" DNBD3_BGR_MIN_CLIENTS=0 DNBD3_LOOKUP="false" - DNBD3_AUTOFREE="18h" + # Delay deletion only if we're booted early + hour="$( date +%_H )" + hour="${hour# }" + if [ "$hour" -lt 7 ]; then + DNBD3_AUTOFREE=$(( 7 - hour )) + else + DNBD3_AUTOFREE=0 + fi + # Wait some more on Sunday + if [ "$( date +%w )" = 0 ]; then + DNBD3_AUTOFREE=$(( DNBD3_AUTOFREE + 18 )) + fi + DNBD3_SERVER_PENALTY=3000 # no BGR = don't like other servers connecting so much if [ -n "${SLX_DNBD3_BGR}" ]; then DNBD3_BGR="true" @@ -244,7 +256,7 @@ removeMissingImages=false uplinkTimeout=5000 clientTimeout=15000 pretendClient=${DNBD3_PRETEND_CLIENT} -autoFreeDiskSpaceDelay=${DNBD3_AUTOFREE} +autoFreeDiskSpaceDelay=${DNBD3_AUTOFREE}h [limits] maxPayload=10M |