mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2025-09-02 02:39:26 +00:00
move functions to utils.sh
This commit is contained in:
parent
e22a08bb7a
commit
8b658bd755
2 changed files with 39 additions and 36 deletions
|
@ -1,41 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function sigterm {
|
source /scripts/utils.sh
|
||||||
stop_socat
|
|
||||||
stop_server
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function start_server {
|
|
||||||
/scripts/create_data_links.sh
|
|
||||||
python3 /scripts/start.py
|
|
||||||
}
|
|
||||||
|
|
||||||
function stop_server {
|
|
||||||
echo "Stopping seafile server..."
|
|
||||||
/opt/seafile/seafile-server-latest/seafile.sh stop
|
|
||||||
}
|
|
||||||
|
|
||||||
function start_socat {
|
|
||||||
echo "Waiting for SeaRPC socket..."
|
|
||||||
while [ ! -S /opt/seafile/seafile-server-latest/runtime/seafile.sock ]; do
|
|
||||||
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..."
|
|
||||||
pkill -15 -f socat
|
|
||||||
sleep 5
|
|
||||||
pkill -9 -f socat
|
|
||||||
}
|
|
||||||
|
|
||||||
function keep_running {
|
|
||||||
while true; do
|
|
||||||
tail -f /dev/null & wait ${!}
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
trap 'sigterm' SIGTERM
|
trap 'sigterm' SIGTERM
|
||||||
start_server &
|
start_server &
|
||||||
|
|
38
seafile-server/scripts/utils.sh
Normal file
38
seafile-server/scripts/utils.sh
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function sigterm {
|
||||||
|
stop_socat
|
||||||
|
stop_server
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_server {
|
||||||
|
/scripts/create_data_links.sh
|
||||||
|
python3 /scripts/start.py
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop_server {
|
||||||
|
echo "Stopping seafile server..."
|
||||||
|
/opt/seafile/seafile-server-latest/seafile.sh stop
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_socat {
|
||||||
|
echo "Waiting for SeaRPC socket..."
|
||||||
|
while [ ! -S /opt/seafile/seafile-server-latest/runtime/seafile.sock ]; do
|
||||||
|
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..."
|
||||||
|
pkill -15 -f socat
|
||||||
|
sleep 5
|
||||||
|
pkill -9 -f socat
|
||||||
|
}
|
||||||
|
|
||||||
|
function keep_running {
|
||||||
|
while true; do
|
||||||
|
tail -f /dev/null & wait ${!}
|
||||||
|
done
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue