mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2025-09-01 18:29:12 +00:00
Merge branch 'seafile-start'
This commit is contained in:
commit
de428fae71
2 changed files with 41 additions and 8 deletions
|
@ -29,9 +29,9 @@ python3-sqlalchemy \
|
||||||
|
|
||||||
ENV SEAFILE_VERSION=8.0.2
|
ENV SEAFILE_VERSION=8.0.2
|
||||||
|
|
||||||
|
COPY --from=get /tmp/seafile-server-${SEAFILE_VERSION} /opt/seafile/seafile-server-${SEAFILE_VERSION}
|
||||||
COPY scripts /scripts
|
COPY scripts /scripts
|
||||||
RUN chmod u+x /scripts/*
|
RUN chmod u+x /scripts/*
|
||||||
COPY --from=get /tmp/seafile-server-${SEAFILE_VERSION} /opt/seafile/seafile-server-${SEAFILE_VERSION}
|
|
||||||
|
|
||||||
RUN mkdir -p /opt/seafile/logs &&\
|
RUN mkdir -p /opt/seafile/logs &&\
|
||||||
ln -sf /dev/stdout /opt/seafile/logs/seafile.log &&\
|
ln -sf /dev/stdout /opt/seafile/logs/seafile.log &&\
|
||||||
|
|
|
@ -1,12 +1,45 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
/scripts/create_data_links.sh
|
function sigterm {
|
||||||
|
stop_socat
|
||||||
|
stop_server
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
python3 /scripts/start.py &
|
function start_server {
|
||||||
|
/scripts/create_data_links.sh
|
||||||
|
python3 /scripts/start.py
|
||||||
|
}
|
||||||
|
|
||||||
while [ ! -S /opt/seafile/seafile-server-latest/runtime/seafile.sock ]; do
|
function stop_server {
|
||||||
echo "Waiting for SeaRPC socket..."
|
echo "Stopping seafile server..."
|
||||||
sleep 1
|
/opt/seafile/seafile-server-latest/seafile.sh stop
|
||||||
done
|
}
|
||||||
|
|
||||||
socat -d -d TCP-LISTEN:8001,fork,reuseaddr UNIX:/opt/seafile/seafile-server-latest/runtime/seafile.sock,forever
|
function start_socat {
|
||||||
|
while [ ! -S /opt/seafile/seafile-server-latest/runtime/seafile.sock ]; do
|
||||||
|
echo "Waiting for SeaRPC socket..."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
socat -d -d TCP-LISTEN:8001,fork,reuseaddr UNIX:/opt/seafile/seafile-server-latest/runtime/seafile.sock,forever
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop_socat {
|
||||||
|
echo "Stopping socat..."
|
||||||
|
ps aux | grep '[s]ocat' | awk '{print $2}' | xargs kill -15 > /dev/null
|
||||||
|
sleep 2
|
||||||
|
if [ -z $(ps aux | grep '[s]ocat')]; then
|
||||||
|
ps aux | grep '[s]ocat' | awk '{print $2}' | xargs kill -9 > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function keep_running {
|
||||||
|
while true; do
|
||||||
|
tail -f /dev/null & wait ${!}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
trap 'sigterm' SIGTERM
|
||||||
|
start_server &
|
||||||
|
start_socat &
|
||||||
|
keep_running
|
Loading…
Add table
Reference in a new issue