|
|
Perl-alternative second effort
Sorry, that little "<" messed my previous post, so here it is in (hopefully) full length:
I like the Idea of the Script, and since I don't know any applescripting and prefer typing some letters to starting an application hidden elsewhere, I wrote a simple Perl-Script to which I aliased 'net', so typing 'net' in the Shell does the same for me.
if someone's interested, here's the code.
#!/usr/bin/perl
# checks for network-availability and quits on success
$sleep = 120; # in seconds
$url = 'http://www.apple.com';
print "testing...";
while(length `curl --connect-timeout 5 --head --silent $url` < 4) {
($sec, $min, $hr) = localtime;
$min =~ s/^(\d{1})$/0\1/;
$sec =~ s/^(\d{1})$/0\1/;
print "\rNetwork Connection NOT available @ $hr:$min:$sec \tsleeping ~$sleep seconds | press CTRL-C to abort";
sleep $sleep;
}
print "\n\a####\nyour Network Connection is up and running.\n####\n";
exit;
bye.
unforeseen
Perl-alternative third effort
this gives me the creeps, there are some Backslashes missing. Sorry, I didn't use the code-option...
line 12:
line 13:
line 14:
line 18:
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.07 seconds |
|