You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

starwelsd.conf 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. description "Starwels Daemon"
  2. start on runlevel [2345]
  3. stop on starting rc RUNLEVEL=[016]
  4. env STARWELSD_BIN="/usr/bin/starwelsd"
  5. env STARWELSD_USER="starwels"
  6. env STARWELSD_GROUP="starwels"
  7. env STARWELSD_PIDDIR="/var/run/starwelsd"
  8. # upstart can't handle variables constructed with other variables
  9. env STARWELSD_PIDFILE="/var/run/starwelsd/starwelsd.pid"
  10. env STARWELSD_CONFIGFILE="/etc/starwels/starwels.conf"
  11. env STARWELSD_DATADIR="/var/lib/starwelsd"
  12. expect fork
  13. respawn
  14. respawn limit 5 120
  15. kill timeout 60
  16. pre-start script
  17. # this will catch non-existent config files
  18. # starwelsd will check and exit with this very warning, but it can do so
  19. # long after forking, leaving upstart to think everything started fine.
  20. # since this is a commonly encountered case on install, just check and
  21. # warn here.
  22. if ! grep -qs '^rpcpassword=' "$STARWELSD_CONFIGFILE" ; then
  23. echo "ERROR: You must set a secure rpcpassword to run starwelsd."
  24. echo "The setting must appear in $STARWELSD_CONFIGFILE"
  25. echo
  26. echo "This password is security critical to securing wallets "
  27. echo "and must not be the same as the rpcuser setting."
  28. echo "You can generate a suitable random password using the following"
  29. echo "command from the shell:"
  30. echo
  31. echo "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'"
  32. echo
  33. echo "It is also recommended that you also set alertnotify so you are "
  34. echo "notified of problems:"
  35. echo
  36. echo "ie: alertnotify=echo %%s | mail -s \"Starwels Alert\"" \
  37. "admin@foo.com"
  38. echo
  39. exit 1
  40. fi
  41. mkdir -p "$STARWELSD_PIDDIR"
  42. chmod 0755 "$STARWELSD_PIDDIR"
  43. chown $STARWELSD_USER:$STARWELSD_GROUP "$STARWELSD_PIDDIR"
  44. chown $STARWELSD_USER:$STARWELSD_GROUP "$STARWELSD_CONFIGFILE"
  45. chmod 0660 "$STARWELSD_CONFIGFILE"
  46. end script
  47. exec start-stop-daemon \
  48. --start \
  49. --pidfile "$STARWELSD_PIDFILE" \
  50. --chuid $STARWELSD_USER:$STARWELSD_GROUP \
  51. --exec "$STARWELSD_BIN" \
  52. -- \
  53. -pid="$STARWELSD_PIDFILE" \
  54. -conf="$STARWELSD_CONFIGFILE" \
  55. -datadir="$STARWELSD_DATADIR" \
  56. -disablewallet \
  57. -daemon