MacBook – Finder drops connection to server / network attached storage

findermacbook promojaveNetworkstorage

I am trying to transfer data that takes days to complete and would like to have a permanent connection to my Network Attached Storage device. I can open finder, then go–> connect to server in order to connect to my network attached storage. However, if I return to my computer and there is a login screen, the connection has been dropped. I would like for the data transfer to continue even while I am logged out, and for the disk to be remounted even if the network connection is temporarily dropped.

I have enabled the connection as a login item as described in https://apple.stackexchange.com/a/20667/1942, but it still doesn't automatically mount the device. An answer to another question, https://apple.stackexchange.com/a/210960/1942, suggests writing an AppleScript to automate this, referencing a blog post from 2008 (>10y ago).

What are my options for automating the mounting in 2019?

I have a MacBook Pro + macOS Mojave 10.14.3

output from smbutil statshares -a

Best Answer

I resolved the issue of keeping the disk mounted by using the caffeinate command. Caffeinate keeps the system from sleeping as described in the man page.