I'm after a way of running a script (on Windows) when a network connection is established.

Background: I'm looking at the potential of having a low powered computer that sits in the boot of my car storing a lot of audio files, running Subsonic and using the Android app as a "jukebox" controller that plays the music through the soundcard of the computer to an input on the stereo, or broadcasts it over a local radio channel to my car stereo. When I arrive home, it will connect to my home wireless, run a sync with my media server to download any music it hasn't got on it, then hibernate.

My question then, is how can I run the sync when I connect to the network? My current idea is to ping the gateway every 30 minutes or so, and if the gateway is pingable, run the sync and hibernate, or if not ping 30 minutes later.

I would prefer some Windows-based trickery such as batch-based files or PowerShell, but if the OS will run Subsonic then I may consider that as well.

I could have a lot of CD's in my car...but that's effort to remeber to do - I'm ovbiously not a fan of the easy life.

link|improve this question

feedback

1 Answer

up vote 5 down vote accepted

Use the windows task scheduler. From the task scheduler (Win7 Control Panel, administrative tools), create a new task to specify your sync batch file. On the conditions tab, there is a network option. Check the

"Start only if the following network connetion is available"

and also any other conditions in triggers etc, to limit the sync to happen per your needs. enter image description here

link|improve this answer
what. what. what. I didn't even know task scheduler would go that detailed, I was only going to use it to run the copy batch file every 30 minutes. – tombull89 Feb 10 at 18:05
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.