I created this simple bash script to perform periodic maintenance. I put the script file in my ~/bin directory, and I added the folliwing line to my .profile file (where my_user is my short username):
export PATH=$PATH:/Users/my_user/bin
Now, when I want to perform maintenance, I open a Terminal window and type maint at the prompt.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20061216131729762