Last Week on My Mac: Macs that go bump in the night

If you leave your Mac running overnight, but not sleeping, what does it do? Does it perform maintenance tasks that it would otherwise have to do during the day?