mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2025-09-05 12:19:13 +00:00
seafile-server: improved lifecycle management and scheduled gc
Exits container if seafile-server or socat exits. Exits the container after scheduled garbage collection. These changes allow a clean restart with deterministic behaviour. It is recommended to set the restart policy for the container to "unless-stopped".
This commit is contained in:
parent
bfeaa2188f
commit
2a176d2d12
3 changed files with 15 additions and 12 deletions
|
@ -3,6 +3,7 @@ source /scripts/utils.sh
|
||||||
SEAFILE_DIR=/opt/seafile/seafile-server-latest
|
SEAFILE_DIR=/opt/seafile/seafile-server-latest
|
||||||
|
|
||||||
if [[ $SEAFILE_SERVER != *"pro"* ]]; then
|
if [[ $SEAFILE_SERVER != *"pro"* ]]; then
|
||||||
|
touch /tmp/gc_active
|
||||||
echo "Seafile CE: Stop Seafile to perform offline garbage collection."
|
echo "Seafile CE: Stop Seafile to perform offline garbage collection."
|
||||||
stop_socat
|
stop_socat
|
||||||
$SEAFILE_DIR/seafile.sh stop
|
$SEAFILE_DIR/seafile.sh stop
|
||||||
|
@ -17,8 +18,7 @@ fi
|
||||||
$SEAFILE_DIR/seaf-gc.sh "$@"
|
$SEAFILE_DIR/seaf-gc.sh "$@"
|
||||||
|
|
||||||
if [[ $SEAFILE_SERVER != *"pro"* ]]; then
|
if [[ $SEAFILE_SERVER != *"pro"* ]]; then
|
||||||
echo "Seafile CE: Offline garbage collection completed. Starting Seafile."
|
echo "Seafile CE: Offline garbage collection completed. Exiting..."
|
||||||
sleep 3
|
echo "Set the restart policy of this container to unless-stopped to restart it automatically after garbage collection."
|
||||||
$SEAFILE_DIR/seafile.sh start
|
rm -f /tmp/gc_active
|
||||||
start_socat &
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -3,8 +3,17 @@
|
||||||
source /scripts/utils.sh
|
source /scripts/utils.sh
|
||||||
trap 'sigterm' SIGTERM
|
trap 'sigterm' SIGTERM
|
||||||
|
|
||||||
gc_cron &
|
rm -f /tmp/gc_active
|
||||||
|
|
||||||
|
gc_cron
|
||||||
start_server &
|
start_server &
|
||||||
start_socat &
|
start_socat &
|
||||||
logger &
|
logger &
|
||||||
keep_running
|
|
||||||
|
wait -n
|
||||||
|
|
||||||
|
while [ -f /tmp/gc_active ]; do
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $?
|
|
@ -47,12 +47,6 @@ function logger {
|
||||||
tail -f /opt/seafile/logs/common.log | tee
|
tail -f /opt/seafile/logs/common.log | tee
|
||||||
}
|
}
|
||||||
|
|
||||||
function keep_running {
|
|
||||||
while true; do
|
|
||||||
tail -f /dev/null & wait ${!}
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function sig_kill_all () {
|
function sig_kill_all () {
|
||||||
pkill -SIGKILL -f "seaf-server -c ${default_ccnet_conf_dir}"
|
pkill -SIGKILL -f "seaf-server -c ${default_ccnet_conf_dir}"
|
||||||
pkill -SIGKILL -f "fileserver -c ${default_ccnet_conf_dir}"
|
pkill -SIGKILL -f "fileserver -c ${default_ccnet_conf_dir}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue