After getting tired of apachectl restart every time my network switches, I did some looking into having launchd do this for me ... I ended up with the following:

1) create a file (I used NetworkChangeApacheRestarter.plist) in / Library/LaunchAgents with the contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.mdimension.NetworkChangeApacheRestarter</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/sbin/apachectl</string>
    <string>restart</string>
  </array>
  <key>WatchPaths</key>
  <array>
    <string>/Library/Preferences/SystemConfiguration</string>
  </array>
</dict>
</plist>

2) save and quit
3) run launchd
4) load /Library/LaunchAgents/NetworkChangeApacheRestarter.plist
5) start com.mdimension.NetworkChangeApacheRestarter
6) profit with all the extra free time you have from not having to run apachectl restart ever again

Note that this is a LITTLE aggressive, because it doesn't specifically watch for network changes, so any system configuration changes will apachectl restart, but that's a pretty non-invasive command all things considered.

ms
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to