Tuesday, October 11, 2011

Re: [LINUX_Newbies] Re: Audible internet disconect sound?

 

On Tue, Oct 11, 2011 at 15:44, grantrocket2 <mars_rover@rocketmail.com> 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!

__._,_.___
Recent Activity:
To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

No comments:

Post a Comment