github.com/slackhq/nebula@v1.9.0/examples/service_scripts/nebula.open-rc (about)

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