Go Back   The macosxhints Forums > OS X Help Requests > Networking



Reply
 
Thread Tools Rate Thread Display Modes
Old 01-28-2013, 03:33 PM   #1
ph0enix
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.
ph0enix is offline   Reply With Quote
Old 01-29-2013, 09:06 AM   #2
agentx
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.
agentx is offline   Reply With Quote
Old 01-30-2013, 06:16 PM   #3
ph0enix
Triple-A Player
 
Join Date: Apr 2006
Posts: 164
Quote:
Originally Posted by agentx
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.

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!
ph0enix is offline   Reply With Quote
Old 02-01-2013, 09:49 AM   #4
agentx
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
agentx 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 10:29 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.