gpsdebuginfo 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #! /bin/sh
  2. # Keep this POSIX, no bash-isms
  3. # make it easy to pipe/save stderr
  4. exec 2>&1
  5. # print what we do
  6. set -x
  7. if [ 0 != $(id -u) ]; then
  8. echo "Please run as root"
  9. exit 1
  10. fi
  11. if [ -n "${SUDO_COMMAND+1}" ]; then
  12. echo "sudo will confuse the results."
  13. fi
  14. id
  15. uname -a
  16. cat /etc/*release
  17. if command -v gpsd; then
  18. # get version
  19. gpsd -V
  20. # get as-built options
  21. gpsd -h | grep '^#.*enabled'
  22. fi
  23. # use sockstat, lsof, netstat or ss, depending, for owner of port 2947
  24. if command -v sockstat; then
  25. # sockstat for FreeBSD
  26. sockstat -l | sed -nE '1p;/:2947 |gpsd/p'
  27. elif command -v lsof; then
  28. lsof -iTCP:2947 -s TCP:LISTEN
  29. # gpsd open files
  30. lsof -c gpsd | sed -nE '1p;/CHR|LISTEN/p'
  31. elif command -v netstat; then
  32. # FreeBSD does not support "-n"
  33. netstat -lp | sed -nE '2p;/:2947 |gpsd/p'
  34. elif command -v ss; then
  35. ss -ltpn | sed -nE '1p;/:2947 |gpsd/p'
  36. fi
  37. ps ax | sed -nE '1p;/gpsd/p'
  38. if command -v gpspipe; then
  39. gpspipe -V
  40. # try to get JSON header
  41. gpspipe -w -n 2 -x 20
  42. fi
  43. if command -v ipcs; then
  44. ipcs -m | sed -nE '/key/p;/KEY/p;/0x4e5450/p'
  45. fi
  46. if command -v ntpshmmon; then
  47. ntpshmmon -V
  48. # 6 lines, or 10 seconds, of ntpshmmon
  49. ntpshmmon -n 6 -t 10
  50. fi
  51. # check for /dev/pps*, /dev/ttyA*, ttyS*, ttyT*, ttyU*
  52. ls -l /dev/pps* /dev/tty[ASTU]*
  53. # check for USB receivers
  54. if command -v lsusb; then
  55. lsusb
  56. fi
  57. echo PYTHONPATH $PYTHONPATH
  58. if command -v gpscat; then
  59. head -n 1 `command -v gpscat`
  60. fi
  61. if command -v python; then
  62. python -V
  63. python -c "import gps;print(gps.__version__)"
  64. fi
  65. if command -v python3; then
  66. python3 -V
  67. python3 -c "import gps;print(gps.__version__)"
  68. fi
  69. if command -v systemctl; then
  70. cat /etc/*/gpsd
  71. systemctl cat gpsd.service
  72. systemctl cat gpsd.socket
  73. systemctl status gpsd.service
  74. systemctl status gpsd.socket
  75. journalctl -u gpsd.service --since today
  76. fi
  77. if command -v aa-status; then
  78. aa-status
  79. elif command -v apparmor_status; then
  80. apparmor_status
  81. fi
  82. # do not print the rest
  83. set +x
  84. echo "Please send the entire, untouched output."
  85. exit 0