> You might want to make sure you change the sleep time to something
> more reasonable... the way that loop is set up, in theory, it'll fire
> off another vlc instance for every second that the link is
> disconnected.
> 
> Maybe change it back to 60 (your original value).  That way, at least,
> you'll have a minute when the alarm goes off to sort it out before the
> loop ticks again and it fires off another vlc... (I'm assuming here
> that it'll keep opening vlcs over and over, instead of just restarting
> the existing one... YMMV because that's a big assumption I've not
> tested)
> 

When testing using mplayer or vlc, the instance of the player would start and 
would not continue untill I closed the program (only one instance)


> 
> errrr.... replace vlc with gnome-mplayer for everything I just said ;-)

Here's the final version of my script, it now plays the sound within the 
terminal, and continues to play the sound every 30 seconds. (sound bit is 4 
seconds long) So I have 27 seconds to sort it out after the alarm goes off.
uses the terminal instance (no GUI) of mplayer instead of gnome-mplayer 

#!/bin/bash

IFACE="ttyUSB0"
SLEEP_TIME="30s"
SOUND_FILE='/home/grant/connection_script/warningredalert.mp3'
WORKING_TEXT='STILL CONNECTED'

while true; do
[ "$(nmcli dev status | grep $IFACE | awk '{print $3'})" == "disconnected" ] && 
mplayer $SOUND_FILE  || echo $WORKING_TEXT
sleep $SLEEP_TIME
done 



------------------------------------

To unsubscribe from this list, please email 
[email protected] & you will be removed.Yahoo! Groups 
Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/LINUX_Newbies/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/LINUX_Newbies/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to