seafile-containerized/cluster/image/pro_seafile_7.1/scripts_7.1/enterpoint.sh
2020-07-16 15:14:10 +08:00

38 lines
621 B
Bash
Executable file

#!/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