entrypoint.sh 901 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. for file in /iptv-api-config/*; do
  3. filename=$(basename "$file")
  4. target_file="$APP_WORKDIR/config/$filename"
  5. if [ ! -e "$target_file" ]; then
  6. cp -r "$file" "$target_file"
  7. fi
  8. done
  9. . /.venv/bin/activate
  10. crontab -d
  11. if [ -n "$UPDATE_CRON" ]; then
  12. echo "$UPDATE_CRON cd $APP_WORKDIR && /.venv/bin/python main.py >> /tmp/dcron.log 2>&1" | crontab -
  13. fi
  14. # dcron log level
  15. # LOG_EMERG 0 [* system is unusable *]
  16. # LOG_ALERT 1 [* action must be taken immediately *]
  17. # LOG_CRIT 2 [* critical conditions *]
  18. # LOG_ERR 3 [* error conditions *]
  19. # LOG_WARNING 4 [* warning conditions *]
  20. # LOG_NOTICE 5 [* normal but significant condition *]
  21. # LOG_INFO 6 [* informational *]
  22. # LOG_DEBUG 7 [* debug-level messages *]
  23. /usr/sbin/crond -b -L /tmp/dcron.log -l 4 &
  24. nginx -g 'daemon off;' &
  25. python $APP_WORKDIR/main.py &
  26. python -m gunicorn service.app:app -b 0.0.0.0:$APP_PORT --timeout=1000