mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 09:01:38 +00:00
add enterpoint.sh
This commit is contained in:
parent
f3e0176f61
commit
ce319c80ec
|
@ -68,4 +68,4 @@ RUN mkdir -p /opt/seafile/ && cd /opt/seafile/ && \
|
|||
EXPOSE 80
|
||||
|
||||
|
||||
CMD ["/sbin/my_init", "--", "bash", "-l"]
|
||||
CMD ["/sbin/my_init", "--", "/scripts/enterpoint.sh"]
|
||||
|
|
|
@ -75,7 +75,7 @@ if [[ ! -e latest_version_dir ]]; then
|
|||
ln -sf $current_version_dir $latest_version_dir
|
||||
fi
|
||||
|
||||
chmod u+x /scripts/*
|
||||
# chmod u+x /scripts/*
|
||||
|
||||
echo $PYTHON
|
||||
$PYTHON /scripts/init.py
|
||||
# echo $PYTHON
|
||||
# $PYTHON /scripts/init.py
|
||||
|
|
37
cluster/image/pro_seafile_7.1/scripts_7.1/enterpoint.sh
Executable file
37
cluster/image/pro_seafile_7.1/scripts_7.1/enterpoint.sh
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/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
|
|
@ -40,7 +40,10 @@ def main():
|
|||
generate_local_nginx_conf()
|
||||
|
||||
if not exists(join(shared_seafiledir, 'conf')):
|
||||
print('Start init')
|
||||
init_seafile_server()
|
||||
else:
|
||||
print('Conf exists')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue