mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 17:05:32 +00:00
702f5da610
* Add garbage collector command to launcher The seafile garbage collector can be started via the 'gc' command option of the launcher. This will stop the seafile-server inside the container, then run the 'seaf-gc.sh' script and redirect its output to '/var/log/gc.log'. Afterwards the whole container will be restarted. * Move garbage collector execution logic to scripts/gc.sh The file gc.sh stops the seafile server, starts the garbage collector and restarts the seafile server when the cleanup is finished. The output of the 'seaf-gc.sh' script is piped to the file '/var/log/gc.log' in append mode. * Add 'scripts/gc.sh' to watch_controller function in 'scripts/start.py' The 'start.py' script monitors the seafile-server in a 'watch_controller' function and terminates the container when the server crashed. However, during a garbage collector cleanup the server needs to be shut down and therefore it is necessary that the 'watch_controller' function only terminates the container if the server is offline and no cleanup is in progress. * Add the gc command info to README * Preseve the exit code of seaf-gc.sh * Fix the perm of scripts/gc.sh
31 lines
455 B
Bash
Executable file
31 lines
455 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Before
|
|
SEAFILE_DIR=/opt/seafile/seafile-server-latest
|
|
|
|
$SEAFILE_DIR/seafile.sh stop
|
|
|
|
echo "Waiting for the server to shut down properly..."
|
|
sleep 5
|
|
|
|
# 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
|
|
|
|
echo "Giving the server some time..."
|
|
sleep 3
|
|
|
|
$SEAFILE_DIR/seafile.sh start
|
|
|
|
exit $gc_exit_code
|