Mint Serena 64 bit using the Mate desktop environment. Most of the following scripts will run on this machine, although some have only been tested with the Gnome desktop. Extra software requirements can be met by the Ubuntu and safe PPA repositories. Scripts may be re-written or added to from time to time, the date serves as the version number. Syntax highlighting on these pages is provided by GVim's "Convert to HTML" option.

Suspend resume tester

#!/bin/bash
# Filename: testsuspend.sh
# Author: robz
# Version: 161010
# Soak test for Suspend/Resume.
# If pm-suspend fails, which in my case means a hard boot instead of a resume,
# I find that booting into WinXP just to the password prompt then rebooting
# into Ubuntu fixes things for a while. This script will then run it's 10 test
# cycles without fault. Of course you need to be running a dual boot machine
# or the above ain't gonna help ya.:)
# Suspends/resumes 10 times, checks for valid internet connection and logs the
# results.

LOG=~/pm-suspend_soak.log
> $LOG                                          # Make a logfile
sudo /bin/true                                  # Get root privileges.
echo -e "Soak testing of \"pm-suspend function\"" | tee $LOG
echo "Test started at: `date +%T`" | tee -a $LOG
sleep 3
for x in {1..10}; do
    sudo killall rtcwake; clear                 # Kill any residual process
    poff; sleep 2                               # Disconnect ADSL
    sudo rtcwake -s 10 -m on & sleep 2          # Wake in 10 seconds
    sudo /usr/sbin/pm-suspend                   # Bodge for bug in rtcwake
    echo -ne "Test $x -- `date +%T` restore good -- " | tee -a $LOG
    sleep 10
    pon adsl; sleep 20                          # Reconnect ADSL
    CHECK=0
    while ! ping -c 1 www.google.com > /dev/null && [ "$CHECK" -le "5" ]; do
        let "CHECK += 1"
        sleep 3
    done
    if ping -c 1 www.google.com; then
        echo "ADSL connection success" | tee -a $LOG
        else echo "but no connection!" | tee -a $LOG
    fi
    echo -e "Soak testing of \"pm-suspend function\""
    echo -e "Test has cycled $x times\nCTRL c to stop"
    for i in {5..1}; do                         # Count down to next suspend
        printf "\r%s""Next test in: "$i
        tput el
        sleep 1                                 # 1 second plus the loop!
    done
clear
done
echo -e "Soak Test Complete\n\n" | tee -a $LOG
cat < $LOG


Powered by ScribeFire.

No comments: