nebula.open-rc 848 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/sbin/openrc-run
  2. #
  3. # nebula service for open-rc systems
  4. extra_commands="checkconfig"
  5. : ${NEBULA_CONFDIR:=${RC_PREFIX%/}/etc/nebula}
  6. : ${NEBULA_CONFIG:=${NEBULA_CONFDIR}/config.yml}
  7. : ${NEBULA_BINARY:=${NEBULA_BINARY}${RC_PREFIX%/}/usr/local/sbin/nebula}
  8. command="${NEBULA_BINARY}"
  9. command_args="${NEBULA_OPTS} -config ${NEBULA_CONFIG}"
  10. supervisor="supervise-daemon"
  11. description="A scalable overlay networking tool with a focus on performance, simplicity and security"
  12. required_dirs="${NEBULA_CONFDIR}"
  13. required_files="${NEBULA_CONFIG}"
  14. checkconfig() {
  15. "${command}" -test ${command_args} || return 1
  16. }
  17. start_pre() {
  18. if [ "${RC_CMD}" != "restart" ] ; then
  19. checkconfig || return $?
  20. fi
  21. }
  22. stop_pre() {
  23. if [ "${RC_CMD}" = "restart" ] ; then
  24. checkconfig || return $?
  25. fi
  26. }