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

29 lines
728 B
Bash
Raw Normal View History

2018-10-27 08:42:54 +00:00
#!/bin/bash
set -e
2021-02-01 13:17:29 +00:00
source /scripts/utils.sh
2018-10-27 08:42:54 +00:00
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."
2021-02-01 13:17:29 +00:00
stop_socat
2021-02-01 11:57:36 +00:00
$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 /opt/seafile/logs/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 13:17:29 +00:00
echo "Seafile CE: Offline garbage collection completed. Starting Seafile."
2021-02-01 11:57:36 +00:00
sleep 3
$SEAFILE_DIR/seafile.sh start
2021-02-01 13:17:29 +00:00
start_socat
2018-10-27 08:42:54 +00:00
fi
exit $gc_exit_code