March 10, 2005

Laptop Maintenence Script


If you own a laptop that runs OS X and you put it to sleep, chances are the built in maintenance scripts don't run often or ever. Cron executes these tasks in the middle of the night by default. This script will run the regular periodic maintenance tasks plus it will repair your disc permissions, updated your prebinding (to make applications start faster), and if you have fink installed it will update that and all your packages too. Just run it with root permission: sudo optimize.sh

#!/bin/sh
#
# optimize.sh

if [ $USER != "root" ]; then
    echo "You must be root to execute this script."
    exit 1
fi

echo "Running periodic daily..."
periodic daily
echo

echo "Running periodic weekly..."
periodic weekly
echo

echo "Running periodic monthly..."
periodic monthly
echo

echo "Repairing permissions..."
diskutil repairPermissions /
echo

echo "Updating prebinding..."
update_prebinding -root /
echo

if [ -e "/sw" ]; then
    echo "Updating Fink..."
    fink -y selfupdate
    fink -y update-all
    fink -y scanpackages
    fink -y index
    fink -y cleanup
    apt-get -y update
    apt-get -y install fink
    apt-get -y upgrade
    apt-get -y dist-upgrade
    apt-get -y clean
    apt-get -y autoclean
    apt-get -y check
    echo
fi

echo -n "Completed "
date
Technorati tags: , , , , , , ,
Posted by joshua at March 10, 2005 1:28 AM
Post a comment









Remember personal info?