rds_check 604 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. set -u
  3. freq='87.9M'
  4. if ! lsusb -d '0bda:2838' > /dev/null; then
  5. echo "UNKNOWN - no RTL-SDR found" 2> /dev/null
  6. exit 3
  7. fi
  8. # TODO: save all output in a tempfile and output it after first line
  9. # dovremmo cercare .ps, ma non trovandolo cerchiamo .pi che esce piu spesso
  10. lines=$(rtl_fm -M fm -l 0 -A std -p 0 -s '171k' -g 20 -F 9 -f "$freq" 2> /dev/null | \
  11. /usr/bin/timeout -s INT 10 redsea | \
  12. jq -r 'select(.pi != null) | .pi'|uniq|wc -l)
  13. if [[ "$lines" -gt 0 ]]; then
  14. echo "OK: rds $lines times"
  15. exit 0
  16. else
  17. echo "CRITICAL: no rds found"
  18. exit 2
  19. fi