entrypoint.sh 982 B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. if [ $# -eq 0 ]; then
  3. printenv > /etc/environment
  4. if [ -f /config.json ]; then
  5. echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
  6. if [ ! -f /ddns/config.json ]; then
  7. ln -s /config.json /ddns/config.json
  8. echo "WARNING: /ddns/config.json not found. Created symlink to /config.json."
  9. fi
  10. echo "WARNING: From v4.0.0, the working dir is /ddns/"
  11. echo "WARNING: Please map your host folder to /ddns/"
  12. echo "[old] -v /host/folder/config.json:/config.json"
  13. echo "[new] -v /host/folder/:/ddns/"
  14. echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
  15. fi
  16. # Use DDNS_CRON environment variable for cron schedule, default to every 5 minutes
  17. CRON_SCHEDULE="${DDNS_CRON:-*/5 * * * *}"
  18. echo "${CRON_SCHEDULE} cd /ddns && /bin/ddns" > /etc/crontabs/root
  19. /bin/ddns && echo "Cron daemon will run with schedule: ${CRON_SCHEDULE}" && exec crond -f
  20. else
  21. first=`echo $1 | cut -c1`
  22. if [ "$first" = "-" ]; then
  23. exec /bin/ddns $@
  24. else
  25. exec $@
  26. fi
  27. fi