Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # shellcheck disable=SC2129
- # Disable consolidating output redirects in shellcheck - they are actually as consolidated as they can be to OUTPUT_FILE
- if [[ $1 == --debug ]] ; then
- set -x
- shift
- fi
- . /etc/tesla.env
- if [ -e /etc/RunQtCar.env ]; then
- . /etc/RunQtCar.env
- fi
- target_mcu() { [ "$UI_TARGET" = "MCU" ]; }
- target_ice() { [ "$UI_TARGET" = "ICE" ]; }
- platform_m3() { [ "$UI_PLATFORM" = "M3" ]; }
- platform_sx() { [ "$UI_PLATFORM" = "SX" ]; }
- have_ic_host() { target_mcu; }
- # run as root
- # XXX: Replace with escalator usage directly from UI when supported on Tegra
- if [ $EUID != 0 ] ; then
- exec /usr/local/bin/notehelper
- fi
- TESLA_CAP_DIR=$TESLA_HOME/.Tesla/data/drivenotes
- mkdir -p "$TESLA_CAP_DIR"
- CAP_DATE=$(date "+%Y-%m-%d-%H:%M:%S")
- OUTPUT_FILE=$TESLA_CAP_DIR/note.$CAP_DATE.txt
- echo "File: $OUTPUT_FILE" > "$OUTPUT_FILE"
- VIN=$(< /var/etc/vin)
- {
- echo "Vin: $VIN"
- # get cid and ic screenshots early to indicate visually we're doing something
- echo
- screenshot
- # get process info
- printf "\n\n-------------------- CID PROCESSES\n"
- ps -AwwL -o pid,ppid,tid,pcpu,vsize,rss,tty,psr,nwchan,wchan:42,stat,start,time,command
- if have_ic_host ; then
- printf "\n\n-------------------- IC PROCESSES\n"
- ssh ic "ps -AwwL -o pid,ppid,tid,pcpu,vsize,rss,tty,psr,nwchan,wchan:42,stat,start,time,command"
- fi
- # save all published data values
- printf "\n\n-------------------- DATA VALUES\n"
- curl -s "http://localhost:4035/get_data_values?format=csv&show_invalid=true"
- # get network config and stats
- printf "\n\n-------------------- NETWORK CONFIGURATION/STATS\n"
- ifconfig
- } >> "$OUTPUT_FILE"
- nme -a >> "$OUTPUT_FILE" 2>/dev/null
- {
- netstat -s
- # get disk stats
- printf "\n\n-------------------- CID DISK INFO\n"
- df
- if ! target_ice ; then # busybox df does not support inode option
- echo
- df -i
- fi
- if have_ic_host ; then
- printf "\n\n-------------------- IC DISK INFO\n"
- ssh ic "df"
- echo
- ssh ic "df -i"
- fi
- # other system info
- if target_mcu ; then
- printf "\n\n-------------------- DSPT\n"
- tail -250 /var/log/dspt.log
- else
- echo
- if platform_m3 ; then
- # Only the Model3 platform has the ability to check the speakers
- # and doing so on Info1/2 causes an audible pop
- AUDIOOPTIONS="check-speakers"
- fi
- AUDIOLOGS=$(/usr/bin/audiologs.sh $AUDIOOPTIONS)
- echo "Audiologs: $AUDIOLOGS"
- fi
- printf "\n\n-------------------- LSUSB\n"
- lsusb -v
- # display status
- if target_ice ; then
- printf "\n\n-------------------- DISPLAYS\n"
- ice-display
- fi
- } >> "$OUTPUT_FILE"
- # post vitals to mothership
- "$TESLA_BIN/mothership.sh" vitals &>/dev/null
- {
- # get memory stats
- printf "\n\n-------------------- CID MEMORY INFO\n"
- cat /proc/meminfo
- echo
- cat /proc/zoneinfo
- echo
- slabtop -o -s c
- if have_ic_host ; then
- printf "\n\n-------------------- IC MEMORY INFO\n"
- ssh ic "cat /proc/meminfo"
- echo
- ssh ic "cat /proc/zoneinfo"
- echo
- ssh -t ic "slabtop -o -s c"
- fi
- } >> "$OUTPUT_FILE"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement