mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-17 01:11:19 +00:00
38 lines
621 B
Bash
38 lines
621 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
|
||
|
# log function
|
||
|
function log() {
|
||
|
local time=$(date +"%F %T")
|
||
|
echo "$time $1 "
|
||
|
echo "[$time] $1 " &>> /opt/seafile/logs/enterpoint.log
|
||
|
}
|
||
|
|
||
|
|
||
|
# check nginx
|
||
|
while [ 1 ]; do
|
||
|
process_num=$(ps -ef | grep "/usr/sbin/nginx" | grep -v "grep" | wc -l)
|
||
|
if [ $process_num -eq 0 ]; then
|
||
|
log "Waiting Nginx"
|
||
|
sleep 0.2
|
||
|
else
|
||
|
log "Nginx ready"
|
||
|
break
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
|
||
|
log "This is a idle script (infinite loop) to keep container running."
|
||
|
|
||
|
function cleanup() {
|
||
|
kill -s SIGTERM $!
|
||
|
exit 0
|
||
|
}
|
||
|
|
||
|
trap cleanup SIGINT SIGTERM
|
||
|
|
||
|
while [ 1 ]; do
|
||
|
sleep 60 &
|
||
|
wait $!
|
||
|
done
|