rtl_airband-gentoo.sh 973 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/sbin/runscript
  2. # rtl_airband Gentoo startup script
  3. # (c) 2015 Tomasz Lemiech <szpajder@gmail.com>
  4. RTLAIRBAND_CONFDIR=${RTLAIRBAND_CONFDIR:-/usr/local/etc}
  5. RTLAIRBAND_CONFIG=${RTLAIRBAND_CONFIG:-${RTLAIRBAND_CONFDIR}/rtl_airband.conf}
  6. RTLAIRBAND_PIDFILE=${RTLAIRBAND_PIDFILE:-/run/${SVCNAME}.pid}
  7. RTLAIRBAND_BINARY=${RTLAIRBAND_BINARY:-/usr/local/bin/rtl_airband}
  8. depend() {
  9. use logger dns
  10. }
  11. checkconfig() {
  12. if [ ! -e "${RTLAIRBAND_CONFIG}" ] ; then
  13. eerror "You need an ${RTLAIRBAND_CONFIG} file to run rtl_airband"
  14. return 1
  15. fi
  16. }
  17. start() {
  18. checkconfig || return 1
  19. ebegin "Starting ${SVCNAME}"
  20. start-stop-daemon --start --exec "${RTLAIRBAND_BINARY}" \
  21. --pidfile "${RTLAIRBAND_PIDFILE}" \
  22. -- ${RTLAIRBAND_OPTS}
  23. eend $?
  24. }
  25. stop() {
  26. if [ "${RC_CMD}" = "restart" ] ; then
  27. checkconfig || return 1
  28. fi
  29. ebegin "Stopping ${SVCNAME}"
  30. start-stop-daemon --stop --exec "${RTLAIRBAND_BINARY}" \
  31. --pidfile "${RTLAIRBAND_PIDFILE}" --quiet
  32. eend $?
  33. }