From f9eca5c59a46fea4785c340fa60b40dd12036fe0 Mon Sep 17 00:00:00 2001 From: Gerrit Gogel Date: Mon, 1 Feb 2021 18:14:46 +0100 Subject: [PATCH] add cron job creation --- seafile-server/scripts/start.sh | 2 +- seafile-server/scripts/utils.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/seafile-server/scripts/start.sh b/seafile-server/scripts/start.sh index 7657ea0..7805453 100644 --- a/seafile-server/scripts/start.sh +++ b/seafile-server/scripts/start.sh @@ -2,7 +2,7 @@ source /scripts/utils.sh -trap 'sigterm' SIGTERM +gc_cron & start_server & start_socat & keep_running \ No newline at end of file diff --git a/seafile-server/scripts/utils.sh b/seafile-server/scripts/utils.sh index 8e121a0..9846ae0 100644 --- a/seafile-server/scripts/utils.sh +++ b/seafile-server/scripts/utils.sh @@ -31,6 +31,13 @@ function stop_socat { pkill -9 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 + service cron start + fi +} function keep_running { while true; do tail -f /dev/null & wait ${!}