Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 06-27-2005, 12:14 AM   #1
LemonFizz
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
LemonFizz is offline   Reply With Quote
Old 06-27-2005, 01:45 AM   #2
toppledwagon
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
toppledwagon is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 01:35 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.