nginx-ui.rc 910 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/sbin/openrc-run
  2. name="nginx-ui"
  3. description="Nginx UI - Yet another WebUI for Nginx"
  4. supervisor=supervise-daemon
  5. command="/usr/local/bin/nginx-ui"
  6. command_args="-config /usr/local/etc/nginx-ui/app.ini"
  7. pidfile="/run/${RC_SVCNAME}.pid"
  8. command_user="root:root"
  9. extra_commands="status"
  10. depend() {
  11. need net
  12. after logger firewall
  13. use dns
  14. after nginx
  15. }
  16. start_pre() {
  17. checkpath --directory --owner $command_user --mode 0755 /run
  18. checkpath --directory --owner $command_user --mode 0755 /usr/local/etc/nginx-ui
  19. }
  20. status() {
  21. if [ -f "${pidfile}" ]; then
  22. PID=$(cat "${pidfile}")
  23. if kill -0 $PID >/dev/null 2>&1; then
  24. einfo "${name} is running (PID: $PID)"
  25. return 0
  26. else
  27. ewarn "${name} is not running (stale PID file)"
  28. return 1
  29. fi
  30. else
  31. einfo "${name} is not running"
  32. return 3
  33. fi
  34. }