emqttd_init.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /etc/init.d/emqttd
  2. ==================
  3. ::
  4. #!/bin/sh
  5. #
  6. # emqttd Startup script for emqttd.
  7. #
  8. # chkconfig: 2345 90 10
  9. # description: emqttd is mqtt broker.
  10. # source function library
  11. . /etc/rc.d/init.d/functions
  12. # export HOME=/root
  13. start() {
  14. echo "starting emqttd..."
  15. cd /opt/emqttd && ./bin/emqttd start
  16. }
  17. stop() {
  18. echo "stopping emqttd..."
  19. cd /opt/emqttd && ./bin/emqttd stop
  20. }
  21. restart() {
  22. stop
  23. start
  24. }
  25. case "$1" in
  26. start)
  27. start
  28. ;;
  29. stop)
  30. stop
  31. ;;
  32. restart)
  33. restart
  34. ;;
  35. *)
  36. echo $"Usage: $0 {start|stop}"
  37. RETVAL=2
  38. esac
  39. chkconfig
  40. ---------
  41. ::
  42. chmod +x /etc/init.d/emqttd
  43. chkconfig --add emqttd
  44. chkconfig --list
  45. boot test on ubuntu
  46. -------------------
  47. ::
  48. service emqttd start
  49. erlexec: HOME must be set
  50. -------------------
  51. uncomment '# export HOME=/root' if "HOME must be set" error.
  52. Referrence
  53. ---------
  54. .. `How to make unix service see environment variables?`_: http://unix.stackexchange.com/questions/44370/how-to-make-unix-service-see-environment-variables/44378#44378