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 +}