Rclone on macosx does not handle sleep gracefully

Hi all,

I’ve been using rclone for a long time, especially on different flavors of macosx.
My energy system preferences are pretty much standard: turn of display after 15 minutes, do not prevent sleep, enable network during sleep, etc.
However after some time rclone is uploading (say, 90 minutes), it starts reporting “network is down”, which is obviously a power-saving related issue (for example: this doesn’t happen if I set the option “prevent the computer from sleeping while the display is off”).
Now… I’m not familiar with macosx development, but I vaguely remember there’s an API for applications to subscribe to “sleep notifications”, and they can approve or prevent.

What would you want rclone to do here? Prevent the sleep or go to sleep itself?

probably prevent sleep, but this could be a command-line option.
what I find annoying is that auto-sleep breaks all existing transfers, and when you resume rclone exits anyway. so you have to relaunch the script (which is quite a waste of time).

Here is a work-around you could use


http://lightheadsw.com/caffeine/ - problem solved

How about adding this to beginning of command ?


as in: /usr/bin/caffeinate -s rclone [etc]


All you need to do to set this in you Mac setting and nothing else, I’ve been using these setting for more than 2 years on my iMac and it’s never turn off or go to sleep.

I am sure there must be a better way to solve this. I like my Mac to go to sleep and not use unnecessary energy. acd_cli with OSXFuse did not have that problem… any other idea=?