
When you set up Address Book to synchronize your contacts with Exchange hourly you probably know the "iSync couldn't connect to Exchange - Could not reach the server specified." for example when you are using your powerbook on the way.
I put a small shell script together which replaces the ExchangeScheduler binary that is called by Apple's scheduler hourly. It has a list of all network locations it should sync in, checks reachability of the outlook web access server and starts the ExchangeScheduler binary then.
Save the following as
ExchangeScheduler.sh in
/System/Library/SyncServices/ExchangeConduit.bundle/Contents/Resources/
#!/bin/bash
syncLocations='73A6408D-CE03-11D8-B5C8-000A95D370A4 26415746-FF16-11D8-B1C7-000A95D370A4'
#syncLocations is a space seperated list of network location id's, the script should sync in.
#You can get your id's by entering scselect into Terminal.app.
ExchangeScheduler='/System/Library/SyncServices/ExchangeConduit.bundle/Contents/Resources/ExchangeScheduler.bin'
activeLocation=`scselect 2>&1 | egrep '^\ *\*'| cut -c 4- | cut -c -36`
for i in $syncLocations
do
if [ "$activeLocation" == "$i" ]
then
if curl -k `defaults read com.apple.IISSupport IISServerPath` >/dev/null 2>&1
then
$ExchangeScheduler $*
fi
fi
done
Open Terminal.app and do the following commands
#change current directory:
cd /System/Library/SyncServices/ExchangeConduit.bundle/Contents/Resources/
#rename ExchangeScheduler to ExchangeScheduler.bin:
sudo mv ExchangeScheduler ExchangeScheduler.bin
#create symlink from ExchangeScheduler.sh to ExchangeScheduler:
sudo ln -s ExchangeScheduler.sh ExchangeScheduler
#grant execute permission to ExchangeScheduler.sh
sudo chmod +x ExchangeScheduler.sh
Test the script by activating a network location that is in $syncLocations and do
./ExchangeScheduler
If the Outlook Web Access Server is reachable the output should be
2004-09-05 10:11:51.302 ExchangeScheduler.bin[14242] Starting exchange sync