After looking through a number of sources on how to schedule a task on OS X Lion, I found out using launchd was the best option, as it will run a missed task as soon as the computer turns on (unlike cron).
Things you’ll need to setup:
1. Create a plist and place it in ~/Library/LaunchAgents. I used a naming scheme similar to Apple’s: org.antonperez.archive-email. BTW, this will run on weekdays at 8:30 AM:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.antonperez.archive-email</string>
<key>ProgramArguments</key>
<array>
<string>/Users/anton.perez/Workspace/archive-email.py</string>
</array>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Weekday</key>
<integer>1</integer>
<key>Hour</key>
<integer>08</integer>
<key>Minute</key>
<integer>30</integer>
</dict>
<dict>
<key>Weekday</key>
<integer>2</integer>
<key>Hour</key>
<integer>08</integer>
<key>Minute</key>
<integer>30</integer>
</dict>
<dict>
<key>Weekday</key>
<integer>3</integer>
<key>Hour</key>
<integer>08</integer>
<key>Minute</key>
<integer>30</integer>
</dict>
<dict>
<key>Weekday</key>
<integer>4</integer>
<key>Hour</key>
<integer>08</integer>
<key>Minute</key>
<integer>30</integer>
</dict>
<dict>
<key>Weekday</key>
<integer>5</integer>
<key>Hour</key>
<integer>08</integer>
<key>Minute</key>
<integer>30</integer>
</dict>
</array>
</dict>
</plist>
2. Now all terminal commands:
launchctl load ~/Library/LaunchAgents/org.antonperez.healthcheck.plist
launchctl start org.antonperez.healthcheck
launchctl list
3. That’s it!