View Single Post
  #1   (View Single Post)  
Old 21st January 2011
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default Play soundfile after some minutes using OpenBSD 'aucat(1)'

Code:
#!/bin/sh
# play soundfile after certain amount of time
# using OpenBSD 'aucat(1)' 

SOUNDFILE="/home/j65nko/thesilentforce/track01.wav"

while true ; do
    printf "Time to wait (mm:ss) = "
    read time
    #time='0:10'
    minutes=${time%:*} 
    seconds=${time#*:}
    pause=$((minutes*60+seconds))
    echo "Waiting $time (${pause} seconds) ...."
    sleep ${pause}
    echo =======================
    echo Playing ${SOUNDFILE}
    aucat -i $SOUNDFILE
    echo ======================
done
A sample run, where I terminate the loop with Control-C:
Code:
$ ./alert-me

Time to wait (mm:ss) : 37:00
Waiting 37:00 (2220 seconds) ....
=======================
Playing /home/j65nko/thesilentforce/track01.wav
======================
Time to wait (mm:ss) =  ^C
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote