Applescript/Automator turn off internet

Joined
Feb 7, 2010
Messages
58
Reaction score
0
Points
6
Your Mac's Specs
MacBook Black 2.4 GHz Intel Core 2 Duo, 4GB 667 MHz DDR2 SDRAM 320gb 7200rpm HDD Snow Leopard
I have satellite internet due to where I live. I have unlimited download/upload from 1-6am and am backing up my mac to a cloud server. I want to set my laptop to turn off wifi at 6am so I do not use up my limit (250mb/day).
Is there an applescript or automater I can use for this? thanks for any help.

I know I can just set the computer to shut down then but have had firefox and other programs at times lock up (not in a long time though) and stop the computer from shutting down.
 
Joined
May 22, 2005
Messages
2,159
Reaction score
67
Points
48
Location
Closer than you think.
Your Mac's Specs
Performa 6116 2GBSCSI 8MB OS 7.5.3
This hint will show you how to disable/enable the Airport of your Mac.
Enable and disable Airport from the command line - Mac OS X Hints

Then use an Automator action to run a shell script with those commands, and then schedule those Automator Applications with iCal to run at 6:00AM and maybe 6:15AM to re-enable.

The problem you will face is running sudo commands unattended. Which is not a good practice.

This thread will go over some methods (with obvious security concerns) as well as methods to limit damage.
Shell script sudo without password prompt under Darwin? [Archive] - The macosxhints Forums
 
Joined
Dec 4, 2007
Messages
3
Reaction score
0
Points
1
FYI, you can also enable/disable the airport/Wi-fi without sudo using:

Code:
networksetup -setairportpower en0 off
or
Code:
networksetup -setairportpower en0 on
I put it in an Automator workflow > Run shell script. Add other stuff to the workflow if needed, then save as Application or Service (to use a hotkey).

* Note: You might need to change the "en0" part to match whichever network device you're wanting to affect. Get a list of all devices with:
Code:
networksetup -listallhardwareports

I'm using OS X Mountain Lion 10.8.2 - The commands might be slightly different on other OS versions. This page has some info:
http://macstuff.beachdogs.org/blog/?p=44
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top