25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

47 satır
1.1 KiB

  1. #!/bin/bash
  2. ### Run as a normal user
  3. if [ $EUID -eq 0 ]; then
  4. echo "This script shouldn't be run as root."
  5. exit 1
  6. fi
  7. ## import common lib
  8. . "$HOME/.noaa.conf"
  9. . "$NOAA_HOME/common.sh"
  10. if [ -z "$1" ]; then
  11. log "Usage: $0 <frequency>. Example: $0 90.3" "ERROR"
  12. exit 1
  13. fi
  14. command_exists() {
  15. if ! command -v "$1" &> /dev/null; then
  16. log "Required command not found: $1" "ERROR"
  17. exit 1
  18. fi
  19. }
  20. command_exists "sox"
  21. command_exists "socat"
  22. IP=$(ip route | grep "link src" | awk {'print $NF'})
  23. if pgrep "rtl_fm" > /dev/null
  24. then
  25. log "There is an existing rtl_fm instance running, I quit" "ERROR"
  26. exit 1
  27. fi
  28. echo "$(tput setaf 2)
  29. The server is in testing mode tuned to $1 Mhz!
  30. Open a terminal in your computer and paste:
  31. ncat $IP 8073 | play -t mp3 -
  32. $(tput sgr0)
  33. "
  34. echo "rtl_fm ${BIAS_TEE} -f "$1M" -s 256k $GAIN -p $PPM_ERROR -E deemp -F 9 -"
  35. rtl_fm ${BIAS_TEE} -f "$1M" -s 256k $GAIN -p $PPM_ERROR -E deemp -F 9 - \
  36. | sox -traw -r256k -es -b16 -c1 -V1 - -tmp3 - \
  37. | socat -u - TCP-LISTEN:8073 1>/dev/null