|
|
#1 |
|
Prospect
Join Date: May 2004
Posts: 1
|
Need help with script to detect network connection status
Hi,
I am trying to get my wife to use Skype. evrything goes well, but when she is not connectd to the web and starts her machine, Skype essentially locks the machine up looking for a network connection so my wife has taken Skype out of her startup items and now desn't use it that much. What I would like to be able to do is write either an applescript or a shell script that I could put in the startup items (or login items) that would look to see if a network connection was active (either ethernet or airport) and if so would start Skype (hidden if possible). If not then (obviously) it wouldn't start it. Can anyone help. I have bought two rather good books on applescript and one on UNIX scripting and still can't find how to get the network connection status...any offers? Cheers, Lemon |
|
|
|
|
|
#2 |
|
Prospect
Join Date: May 2005
Posts: 41
|
I don't know how Apple's internal networking does this, but here is one way:
#!/bin/sh /sbin/ping -c 1 `head -1 /etc/resolv.conf | awk '{ print $2 }'` > /dev/null if [ $? -eq 0 ]; then echo "I can reach my first name server." else echo "I can not reach my first name server." fi -Dave |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|