#!/bin/sh BURNIN_DEVICE=default RUNFOR=100 echo "Burn-in started at `date`." echo "Burning in for $RUNFOR hours, press Ctrl+C to abort." echo "Playing pink noise on ALSA device $BURNIN_DEVICE." function calcruntime { endtime=`date +%s` duration=$(($endtime - $starttime)) timerunh=$(( $duration / 60 / 60 )) timerunm=$(( ($duration / 60) - ($timerunh * 60) )) timeruns=$(( ($duration) - ($timerunh * 60 * 60) - ($timerunm * 60) )) } function exitburnin { killall speaker-test calcruntime echo "Process terminated at `date` after $timerunh hours, $timerunm minutes and $timeruns seconds." exit } trap "exitburnin" SIGINT SIGTERM starttime=`date +%s` i=1 while (( i = 1 )); do exec speaker-test -D $BURNIN_DEVICE -c1 &> /dev/null & sleep 2h killall speaker-test calcruntime if [ $timerunh == $RUNFOR ]; then exitburnin; fi echo "Completed 120 minute cycle, resting for 30 minutes." sleep 30m echo "Continuing burn-in." done