From ff1c91c6d166dc279ab6122c3464d54565904a5b Mon Sep 17 00:00:00 2001 From: Gerrit Gogel Date: Mon, 19 Jun 2023 02:57:13 +0200 Subject: [PATCH] Check if cron entry for garbage collection already exists --- seafile-server/scripts/utils.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/seafile-server/scripts/utils.sh b/seafile-server/scripts/utils.sh index ecdc4f4..6099fc0 100644 --- a/seafile-server/scripts/utils.sh +++ b/seafile-server/scripts/utils.sh @@ -34,7 +34,11 @@ function stop_socat { function gc_cron { if [[ ! -z $GC_CRON ]]; then echo "Scheduling garbage collection..." - (crontab -l ; echo "$GC_CRON /scripts/gc.sh >> /opt/seafile/logs/gc.log 2>&1") | crontab + + if ! crontab -l | grep -Fxq "$GC_CRON /scripts/gc.sh >> /opt/seafile/logs/gc.log 2>&1"; then + (crontab -l ; echo "$GC_CRON /scripts/gc.sh >> /opt/seafile/logs/gc.log 2>&1") | crontab + fi + service cron start fi } @@ -58,4 +62,4 @@ function sig_kill_all () { pkill -SIGKILL -f "wsgidav.server.server_cli" pkill -SIGKILL -f "notification-server -c ${central_config_dir}" pkill -SIGKILL -f "seafile-monitor.sh" -} \ No newline at end of file +}