Back in 2008, I reviewed Leech, an excellent download manager that takes the place of your Web browser’s file-download feature to provide a good deal more functionality. (Unfortunately, Leech appears to be no longer available, as the developer’s Website has been offline for some time now.)
One of Leech’s convenient features is that the program can automatically shut down your Mac once all downloads have finished. But as much as I liked this feature, I found it odd that Leech couldn’t instead sleep your Mac when downloads were done.
Michael Hawelka's GoodNight can do just that, although instead of monitoring downloads, GoodNight monitors all your Mac’s network activity (well, almost; see below). This approach has the obvious benefit of working with any program; for example, you could start a late-night file download with an FTP or BitTorrent client, knowing your Mac would sleep when the download was complete. But GoodNight also monitors traffic from services provided by the operating system itself, such as File Sharing.
To set up GoodNight, first you choose which network port—Ethernet, AirPort, FireWire, and so on—you want the program to monitor. GoodNight cannot monitor multiple network interfaces, or all network traffic, simultaneously, although for most users, this won’t be an issue, as it’s a rare situation where you’d need to monitor more than one network interface.
Then you choose whether you want GoodNight to monitor download or upload traffic, and choose the “speed limit”—the threshold of traffic, in kilobits per second, below which GoodNight decides your Mac is inactive and puts it to sleep. Don’t worry about network traffic momentarily dipping below your limit; GoodNight uses a one-minute average—the average traffic rate over the previous minute—so fluctuating data rates won’t trigger sleep.
Conversely, by using a minimum data rate, rather than no network traffic, as the sleep trigger, GoodNight allows your Mac to sleep even if, say, an Internet program continually pings a remote server to maintain a connection. A useful display shows the average network traffic rate over the past minute to help you determine what a good non-zero limit would be.
The final setting may be the most important: the time limit. Rather than immediately putting your Mac to sleep when the network data rate falls below your speed limit, you can choose to have GoodNight wait until network traffic has stayed below that limit for the duration of time you specify. This feature provides even more cushion for erratic connections, but it’s also useful if you’ve got a Mac that acts as a file server and you want it to sleep only after you’ve finished transferring various bunches of files.
For example, I configured the program to put my file-sharing Mac mini to sleep after 10 minutes of low network traffic. The 10-minute time limit meant that the Mac didn’t go to sleep immediately after a particular file transfer was done; instead, I got a 10-minute “grace period” to start copying any other files.
Unfortunately, the longest time limit you can configure is 10 minutes. I found myself wishing I could set my Mac mini to sleep after an hour of no network activity. This would have prevented the mini from sleeping during business hours—during the day, I rarely go over an hour without accessing the mini over the network—but would have put it to sleep after the work day finished.
There’s also an option to have GoodNight start monitoring your network traffic only after your network data rate exceeds the speed limit. This is useful if you’re trying to download from a busy server: GoodNight waits until your Internet program makes a connection and begins to download the desired file, and then waits until that download completes to put your Mac to sleep. (A sub-setting here lets you designate a time limit for giving up on the connection; for example, if the data-transfer rate doesn’t pass the speed limit after 15 minutes, GoodNight can immediately put your Mac to sleep.)
In addition to the minor issues I mentioned previously, a confusing aspect of GoodNight is that when choosing which network port to monitor, the options aren’t listed as Ethernet, AirPort, and FireWire. Instead, they use OS X’s under-the-hood designations: en0, en1, en2, fw0, and the like. If you don’t know which port is which, launch Network Utility (in /Applications/Utilities), click the Info tab, and then choose your current network interface from the pop-up menu; the designation in parentheses (for example, en1) is what you want to choose in GoodNight.