Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'a helper script to use with this' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
a helper script to use with this
Authored by: delight1 on Jun 25, '07 08:31:29AM
because of my often bad connection, and a lack of getting perl to work, i wrote a unix script to only run these perl script if there is internet.

this keeps the mail queue clean, stops "blank" mail (no internet, no ip to send), and can cut down crontab entries.


#there are TWO spaces (" "), after EACH escape slash "\"
EN0=`ifconfig en0 | grep inet\ | cut -d\ -f 2`
EN1=`ifconfig en1 | grep inet\ | cut -d\ -f 2`

#checks if connected to router
if [ $EN0 $EN1 ]; then
ping -c 1 &> /dev/null
Exit_Status=`echo "$?"`
#checks if connected to interwebz
if [ $Exit_Status == 0 ]; then
#end of srcipt

to use this you would, of course, edit it to include the right scripts, and add it to the crontab ^_^

[ Reply to This | # ]