#!/bin/bash mkdir -p ~/.aims LOGFILE=~/.aims/$HOSTNAME WELCOME="This script will post system information on a public pastebin for support purposes. You will have a chance to review the data before the information is posted. Afterwards, you will receive a link that you can submit to your support department containing the support data." if [ "$1" = "gui" ]; then zenity --title "AIMS Desktop Support" --info --text "$WELCOME" --icon-name="aims-starburst" --width=480 fi if [ "$1" = "menu" ]; then whiptail --title "AIMS Desktop Support" --msgbox \ "$WELCOME Use the arrow buttons to navigate and ENTER to select." 12 70 fi echo " * Writing data to $LOGFILE..." ( echo -e "== Basic System Information ==\n" echo " * System Time: $(date)" echo " * Hostname: $HOSTNAME" echo " * Username: $USER" echo " * Kernel Version: $(uname -r)" ) > $LOGFILE echo -e "\n== Memory Information ==\n" >> $LOGFILE free -h >> $LOGFILE echo -e "\n== Top Memory Using Processes ==\n" >> $LOGFILE echo '%Mem Process' >> $LOGFILE ps ax -o %mem -o comm | tail -n+2 | sort -nr | head >> $LOGFILE echo -e "\n== Disk Space Usage==\n" >> $LOGFILE df -h >> $LOGFILE echo -e "\n== PCI Devices ==\n" >> $LOGFILE lspci >> $LOGFILE echo -e "\n== Attached USB Devices ==\n" >> $LOGFILE lsusb >> $LOGFILE echo -e "\n== Network Configuration ==\n" >> $LOGFILE echo "Routing:" >> $LOGFILE /sbin/route >> $LOGFILE echo -e "\nInterfaces:" >> $LOGFILE /sbin/ifconfig >> $LOGFILE echo -e "\n== APT Status ==\n" >> $LOGFILE echo -e "Contents of /etc/apt/sources.list.d/:" >> $LOGFILE ls -1 /etc/apt/sources.list.d >> $LOGFILE echo -e "\n== CPU Information ==\n" >> $LOGFILE cat /proc/cpuinfo >> $LOGFILE if [ "$1" = "menu" ]; then whiptail --scrolltext --title "AIMS Desktop Support" --textbox $LOGFILE 23 78 whiptail --title "AIMS Desktop Support" --yesno " Submit data to pastebin?" 7 38 if [ "$?" = "1" ]; then ACTION="abort" fi fi if [ "$1" = "gui" ]; then zenity --title "AIMS Desktop Support" --text-info --filename=$LOGFILE --ok-label="Submit to Pastebin" --width=480 --height=600 if [ "$?" = "1" ]; then ACTION="abort" fi fi if [ "$ACTION" = "abort" ]; then ABORT_TEXT="Support request aborted." if [ "$1" = "menu" ]; then whiptail --title "AIMS Desktop Support" --msgbox "$ABORT_TEXT." 10 48 fi if [ "$1" = "gui" ]; then zenity --title "AIMS Desktop Support" --info --text "$ABORT_TEXT" --icon-name="aims-starburst" fi exit 1 fi echo " * Sending information to pastebin..." pastebinurl=$(pastebinit $LOGFILE) INFOTEXT="Information has been posted to $pastebinurl. Share that URL with your IT centre for further assistance." if [ "$1" = "menu" ]; then whiptail --title "AIMS Desktop Support" --msgbox "$INFOTEXT" 10 48 fi if [ "$1" = "gui" ]; then zenity --title "AIMS Desktop Support" --info --text "Information has been posted to $pastebinurl. Share that URL with your IT centre for further assistance." --icon-name="aims-starburst" --width=480 fi echo " * Pastebin URL is $pastebinurl"