How to prevent Safari from stopping downloads when sleeping? I am using macOS Server to host files on a website. I often need to download large files to the server to host them myself.  Because I do not usually have physical access to the server, I use the default Screen Sharing app In macOS from a different mac into the server (VNC). From there I open Safari (on the server) enter the url and start the download. The files range from 400MB to 2GB. They are downloaded to an external drive that is constantly plugged into the Mac.  Once the download starts it can take a while to complete so I often disconnect through the screen sharing. Unfortunately, a minute or two after I disconnect the download stops. When I check what happened by clicking on the download arrow in Safari it says that the download timed out. If I try to continue the download, it continues only to be stopped again when I quit the screen sharing. This is extremely frustrating as I am forced to keep the connection open while it is downloading. 

My settings in the Energy Saving tab of System Preferences are as follows.

Computer Sleep: Never

Display Sleep: 5 Minutes

Put Hard Drives to Sleep when possible: Checked

Wake for Network Access: Checked

-

Schedule

Start up or wake: Every day at 6:30 AM

Sleep: Every Dat at 12:00 AM

Note: The downloads are NOT taking place between 12:00 AM and 6:30 AM

Thanks!
Could not figure out why this was happening but using the caffeinate command I was able to fix it. 

https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/caffeinate.8.html

I ended up just created a LaunchDaeomon to run it at certain times.