Search
Enter Keywords:
Home
OS X Script to Flush lookupd Cache PDF Print E-mail
User Rating: / 1
PoorBest 
Written by Michael Salsbury   
Friday, 03 June 2005

The lookupd process is a component of Mac OS X which allows programs running on the system to request information about other users and computers on the network.  This process uses an in-memory cache to store information about recent activity.  This cache can become outdated, inaccurate, or incomplete as a result of changes on the network, or through bugs in lookupd.  To correct some kinds of network problems, it is helpful for troubleshooting purposes to clear out or "flush" the lookupd cache.

The script below attempts to flush the lookupd cache, then kill the relevant processes.  Those processes will be automatically restarted by OS X after they're killed.

As with all my scripts, while I've tested this on a number of Mac OS X 10.3.x systems and it appears to work as designed, I provide it "as is" without warranty or support.  If you choose to use it, you assume all responsibility and liability for whatever happens (good or bad).

This script can be run from the command line or a cron task.

#! /bin/csh -f
echo " "
echo "This script will flush the lookup cache on the machine and then"
echo "kill/restart the netinfo and lookupd processes." 
echo " "
echo "Enter the admin/root password when/if prompted."
echo " "
sudo lookupd -flushcache
sudo kill -HUP `sudo cat /var/run/netinfo_local.pid`
sudo kill -HUP `sudo cat /var/run/lookupd.pid`
echo " "
echo "Finished."