#!/bin/bash # This script will gather some diagnostics from the tivo and post them back to the server as a tar file function dirlist() { for f in *; do if [ -h "$f" ]; then echo "L $PWD/$f" elif [ -d "$f" ]; then echo "D $PWD/$f" cd $f dirlist cd .. else echo "F $PWD/$f" fi done } putlog() { echo "$(date +%Y-%m-%d:%H:%M:%S): $patchref: $1" >>"$LOGFILE" echo "$(date +%Y-%m-%d:%H:%M:%S): $patchref: $1" } DIAGFILE="/var/log/diagnostics" LOGFILE="/var/log/patchlog" TARFILE="/var/tmp/diagnostics.tar" TARFILE_Z="$TARFILE.gz" patchref="diagnostics" SysSerial=$(crypto -gsn) HDA_ID=$(driveid /dev/hda 2>/dev/null) HDB_ID=$(driveid /dev/hdb 2>/dev/null) HDA_MODEL=$(hdparm -I /dev/hda 2>/dev/null) HDB_MODEL=$(hdparm -I /dev/hdb 2>/dev/null) ENVIRONMENT=$(set) # DIRLIST=$(ls -lR 2>/dev/null) DIRLIST=$(dirlist) IFCONFIG=$(ifconfig) ROUTING=$(route.tivo 2>/dev/null) # command may not exist for unmodified tivo PROCSTATS=$(for stat in cpuinfo meminfo modules mounts therm uptime version; do echo ">>>>>>> $stat <<<<<<<" ; cat /proc/$stat; done) cat <$DIAGFILE ============ HARDWARE =============== TCID=$SysSerial HDA_ID=$HDA_ID HDB_ID=$HDB_ID HDA_MODEL=$HDA_MODEL HDB_MODEL=$HDB_MODEL ============ SOFTWARE =============== ALTEPG_VERSION=$ALTEPG_VERSION ============ NETWORKING ============= DYNAMIC_NET_DEV=$DYNAMIC_NET_DEV >>>>>>> IFCONFIG <<<<<<< $IFCONFIG >>>>>>> ROUTING <<<<<<< $ROUTING ============ ENVIRONMENT ============ $ENVIRONMENT ============ DIRLIST ================ $DIRLIST ============ PROCSTATS ============== $PROCSTATS ===================================== ! rm -f $TARFILE rm -f $TARFILE_Z # find /var/log -print | cpio -o -Htar >$TARFILE 2>/dev/null for f in /var/log/*; do echo $f; done | cpio -o -Htar >$TARFILE 2>/dev/null gzip $TARFILE # send files back to the server http_post $TARFILE_Z http://194.1.151.205:80/tivo-service/file-post.pl?$TARFILE_Z OFF OFF ON >/dev/null # http_post $LOGFILE http://194.1.151.205:80/tivo-service/file-post.pl?$LOGFILE OFF OFF ON >/dev/null