seafile-containerized/seafile-server/scripts/gc.sh

26 lines
626 B
Bash
Raw Normal View History

2018-10-27 08:42:54 +00:00
#!/bin/bash
set -e
SEAFILE_DIR=/opt/seafile/seafile-server-latest
if [[ $SEAFILE_SERVER != *"pro"* ]]; then
2021-02-01 11:57:36 +00:00
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
2018-10-27 08:42:54 +00:00
else
2021-02-01 11:57:36 +00:00
echo "Seafile Pro: Perform online garbage collection."
2018-10-27 08:42:54 +00:00
fi
(
set +e
$SEAFILE_DIR/seaf-gc.sh "$@" | tee -a /var/log/gc.log
2018-10-27 08:42:54 +00:00
exit "${PIPESTATUS[0]}"
2021-02-01 11:57:36 +00:00
) gc_exit_code=$?
2018-10-27 08:42:54 +00:00
if [[ $SEAFILE_SERVER != *"pro"* ]]; then
2021-02-01 11:57:36 +00:00
echo "Giving the server some time..."
sleep 3
$SEAFILE_DIR/seafile.sh start
2018-10-27 08:42:54 +00:00
fi
exit $gc_exit_code