Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

crashwins

macrumors regular
Original poster
Sep 11, 2009
145
1
Not sure how to keep this script running given my computer times out, goes to sleep, shuts down hard drives, etc, when I'm not sitting there. I guess there's LittleSnitch, but how should I keep this script running on my iMac (short of buying a RaspberryPi and using that as a little server, which would be a PITA)? Anyone advice would be most welcome -- thank you!
 
1. If you want your computer to act as a server, you need to disable sleep completely.

You can keep "Spin down disk" enabled, as it will automatically spin up again when needed. The main effect of disk spindown is that the first client request after spindown that needs the disk will take several seconds. Subsequent client requests within the spindown window will be fast. This only applies to a spinning disk, not an SSD.

I run a Mac mini as a server like this: sleep disabled, spindown at 10 mins.


2. If you only run your Python script sometimes, and don't want to disable sleep completely, then use the 'caffeinate' cmd when you run your script.
https://developer.apple.com/legacy/...win/Reference/ManPages/man8/caffeinate.8.html

If you then terminate your script, the sleep-disabling assertion will disappear, and the machine will sleep again using whatever timeouts are in force.


3. Personally, I might not rule out a Pi. Pi Zero, $5:
https://www.adafruit.com/product/2885

It depends on a number of factors, mostly involving power supply, connectors, and what I wanted the server to do overall, but $5 is pretty cost-effective.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.