If you use a Mac whether true server or a Mac Mini for a server this script below is very helpful to prevent the Mac from falling asleep and preventing the machine from being a server.
# Disable Computer Sleep sudo systemsetup -setcomputersleep Off sudo systemsetup -getcomputersleep # Disable Computer Safe Sleep sudo pmset -a hibernatemode 0 sudo nvram "use-nvramrc?"=false # Remove Sleep Image sudo rm /private/var/vm/sleepimage
If all of this still does not do it you can try to caffeinate your mac
caffeinate -t 144000 &
To re-enable sleep settings
# Enable Computer Sleep after 60 minutes sudo systemsetup -setcomputersleep 60 sudo systemsetup -getcomputersleep # Enable Computer Safe Sleep sudo pmset -a hibernatemode 3 sudo nvram "use-nvramrc?"=true
References:
- http://osxdaily.com/2015/02/03/set-or-disable-sleep-due-to-mac-system-inactivity-from-the-command-line-in-os-x/
- https://www.recoveryforce.com/how-to-disable-safe-sleep-in-macos-10/
- http://osxdaily.com/2012/08/03/disable-sleep-mac-caffeinate-command/