How to monitor and log my internet connectivity on Mojave I need to run a program remotely and need to keep my iMac (Mojave) connected to internet for hours. It seems when I leave my iMac, my program will stop running. I suspect that is due to some internet connectivity issue. I have my iMac so that it never goes to sleep when my display does in the power saver.

[Edited: Added] I need to know about internet reachability with a timestamp and Not the time when my program exits!

Are there software or scripts I could run periodically to make a log of this?
Apple’s Wireless Diagnostics tool might work. It appears to be able to monitor your connectivity and provide a report based on the results. You can find it in spotlight search.