cjdns-dynamic.conf 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. description "cjdns dynamic DNS peer resolver startup script"
  2. author "Adam Novak <interfect@gmail.com>"
  3. # Based on cjsdns Upstart config by Sergey Davidoff <shnatsel@gmail.com>
  4. # Requires that you be using Upstart to control cjdns
  5. start on started cjdns
  6. stop on stopping cjdns
  7. # respawn if it crashes, but no more than once in 180 seconds
  8. respawn
  9. respawn limit 2 300
  10. pre-start script
  11. if ! [ -e /etc/cjdns-dynamic.conf ]; then
  12. ( # start a subshell to avoid side effects of umask later on
  13. umask 077 # to create the file with 600 permissions without races
  14. # Make an empty config file; nodes to contact go here.
  15. touch /etc/cjdns-dynamic.conf
  16. # By default we install a config, so this only happens if the user
  17. # deletes it
  18. ) # exit subshell; umask no longer applies
  19. echo 'WARNING: A new cjdns-dynamic.conf file has been generated.'
  20. fi
  21. if ! [ -e /etc/cjdns-dynamic.cjdnsadmin ]; then
  22. ( # start a subshell to avoid side effects of umask later on
  23. umask 077 # to create the file with 600 permissions without races
  24. # Make a cjdnsadmin file from the cjdroute.conf. We're not using
  25. # /root/.cjdnsadmin because that would be silly.
  26. # TODO: Make the cjdns Upstart job put something in /var that other
  27. # root processes can read.
  28. /usr/lib/cjdns/cjdnsadminmaker.py /etc/cjdns-dynamic.cjdnsadmin
  29. ) # exit subshell; umask no longer applies
  30. echo 'WARNING: A new cjdns-dynamic.cjdnsadmin file has been generated.'
  31. fi
  32. end script
  33. exec /usr/lib/cjdns/dynamicEndpoints.py /etc/cjdns-dynamic.conf --adminInfo /etc/cjdns-dynamic.cjdnsadmin