|
As part of its normal operation, OS X creates a number of cache files that allow it to speed up its operations. Like any files, these cache files can become corrupted, fragmented, or otherwise damaged. This can cause the system to slow down, crash, or behave erratically. To prevent such problems, I developed the following script to delete the system cache files on the computer each night and force a reboot to maintain the system's integrity (since deleting a cache file the OS is using would be "a bad thing"). While I've tested this script on Mac OS X 10.3.x and 10.4 and believe that it functions as designed, I can't promise that it will work on earlier or later OS X releases and provide no warranty or support. As with all my scripts, this one is provided "as is". If you are able to make use of it and derive value from it, great! If not, you assume all responsibility and liability for what happens to your system if you choose to use or modify this script. This script can be executed from the command line or via a cron task.
#!/bin/csh # # This script will clean out the various system cache files and then # force a reboot to ensure system integrity. # # Updated: October 5, 2004 # By: Mike Salsbury # # echo " " echo "This script will clean the system cache on the machine." echo " " echo "When it is finished, the Mac should be rebooted to ensure that it" echo "does not become unstable." echo " " echo "Enter the admin/root password if/when prompted." echo " " sudo rm -f /System/Library/Caches/* sudo rm -f /Library/Caches/* sudo rm -f /System/Library/Extensions.kextcache sudo shutdown -r now echo " " echo "Finished cleaning system cache. Please reboot the machine now."
Related Blogs:
Related Links:
|