On Tue, Oct 11, 2011 at 15:44, grantrocket2 <[email protected]> wrote:
> Seems to work great, now to clean up the code a bit (using your example)
>
> #!/bin/bash
>
> IFACE="ttyUSB0"
> SLEEP_TIME="1s"
> SOUND_FILE='/home/grant/Desktop/warningredalert.mp3'

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)

>
> while true; do
> [ "$(nmcli dev status | grep $IFACE | awk '{print $3'})" == "disconnected" ] 
> && vlc $SOUND_FILE  || echo "STILL CONNECTED"
> sleep $SLEEP_TIME
> done
>
> And it works great. Since I use VLC for just about everything, it would be 
> nice if I had a different player to run it in loop.
> So since I have gnome mediaplayer already instaled. I replace vlc with 
> gnome-mplayer and set it to loop (settings menu)
> The player just keep the settings so when it's done, it loops again.

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

> Thanks a million guys!


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

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