|
|
#1 |
|
Triple-A Player
Join Date: Apr 2006
Posts: 164
|
How to run a script on network change
I have an issue with Mountain Lion systems that are on a multi-homed network with two routers. The problem is that Mac's don't support the DHCP option 121/249 (classless routes) the way Windows systems do so I needed to create a start-up script that automatically adds static routes to Mac. I used this method:
http://nellen.it/blog/2012/01/perman...-for-mac-os-x/ The method works fine when the macs boot on the network with two routers since the start-up script runs on boot. The problem is when people bring their Macs in sleep mode, wake them up and then plug them to the network. The script doesn't run so the machines can't get to certain subnets until static routes are added manually. Is there a way to run a script every time the DHCP lease is renewed? Thanks! ![]() J. |
|
|
|
|
|
#2 |
|
Hall of Famer
Join Date: Feb 2003
Location: Brighton, UK
Posts: 3,811
|
Startupitems is depreciated and should not really be used and of course only done on startup.
You should be using launchd it will do everything you need it to. It should be a system level agent not user level. and also look at using http://www.controlplaneapp.com/feature-list/ as it will deal with sleep/wake script running. Last edited by agentx; 01-29-2013 at 09:09 AM. |
|
|
|
|
|
#3 | |||||||||||||||||||||||
|
Triple-A Player
Join Date: Apr 2006
Posts: 164
|
Thanks! Could you point me in the right direction? How do I use launchd? I saw the controlplaneapp? I would prefer to get the job done without installing any third party software. Thanks! |
|||||||||||||||||||||||
|
|
|
|
|
#4 |
|
Hall of Famer
Join Date: Feb 2003
Location: Brighton, UK
Posts: 3,811
|
you will have to use Sleepwatcher as launchd will not work on sleep/wake. A bit of a fail IMHO.
http://www.bernhard-baehr.de |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|