emqx.service 986 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. [Unit]
  2. Description=emqx daemon
  3. After=network.target
  4. [Service]
  5. User=emqx
  6. Group=emqx
  7. # The ExecStart= is foreground, so 'simple' here
  8. Type=simple
  9. Environment=HOME=/var/lib/emqx
  10. # Enable logging to file
  11. Environment=EMQX_LOG__TO=default
  12. # Start 'foregroun' but not 'start' (daemon) mode.
  13. # Because systemd monitor/restarts 'simple' services
  14. ExecStart=/bin/bash /usr/bin/emqx foreground
  15. # Give EMQX enough file descriptors
  16. LimitNOFILE=1048576
  17. # ExecStop is commented out so systemd will send a SIGTERM when 'systemctl stop'.
  18. # SIGTERM is handled by EMQX and it then performs a graceful shutdown
  19. # It's better than command 'emqx stop' because it needs to ping the node
  20. # ExecStop=/bin/bash /usr/bin/emqx stop
  21. # Wait long enough before force kill for graceful shutdown
  22. TimeoutStopSec=120s
  23. Restart=on-failure
  24. # Do not restart immediately so the peer nodes in the cluster have
  25. # enough time to handle the 'DOWN' events of this node
  26. RestartSec=120s
  27. [Install]
  28. WantedBy=multi-user.target