I have ports open on a Mac for specific services. Is there a way to have the OS report through e-mail (Smtp) once a connection is established to one of the ports of interest?
The simplest solution - to use crontab. Create a file similar to the following:
Save it as
Checking will be executed every 3 seconds, but the difference in time between the notifications will not be less than 20 minutes, so as not to make it into a spam. You can change these numbers to other, what right for you. And finally - you need to specify the crontab daemon to file: