From f14e2393a3116d808e7ccc0c1e44298b16d59d7d Mon Sep 17 00:00:00 2001 From: Gerrit Gogel Date: Mon, 1 Feb 2021 12:57:36 +0100 Subject: [PATCH] refactor gc.sh --- seafile-server/scripts/gc.sh | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/seafile-server/scripts/gc.sh b/seafile-server/scripts/gc.sh index 4531933..0975f2e 100644 --- a/seafile-server/scripts/gc.sh +++ b/seafile-server/scripts/gc.sh @@ -1,37 +1,25 @@ #!/bin/bash - set -e - -# Before SEAFILE_DIR=/opt/seafile/seafile-server-latest if [[ $SEAFILE_SERVER != *"pro"* ]]; then - echo "Seafile CE: Stop Seafile to perform offline garbage collection." - $SEAFILE_DIR/seafile.sh stop - - echo "Waiting for the server to shut down properly..." - sleep 5 + echo "Seafile CE: Stop Seafile to perform offline garbage collection." + $SEAFILE_DIR/seafile.sh stop + echo "Waiting for the server to shut down properly..." + sleep 5 else - echo "Seafile Pro: Perform online garbage collection." + echo "Seafile Pro: Perform online garbage collection." fi -# Do it ( set +e $SEAFILE_DIR/seaf-gc.sh "$@" | tee -a /var/log/gc.log - # We want to presevent the exit code of seaf-gc.sh exit "${PIPESTATUS[0]}" -) - -gc_exit_code=$? - -# After +) gc_exit_code=$? if [[ $SEAFILE_SERVER != *"pro"* ]]; then - echo "Giving the server some time..." - sleep 3 - - $SEAFILE_DIR/seafile.sh start + echo "Giving the server some time..." + sleep 3 + $SEAFILE_DIR/seafile.sh start fi - exit $gc_exit_code