Skip to content
Advertisement

Bash : Configuring email-provider for bash-script

I am working on writing a script to run on our Debian server(Debian 3.2.68-1+deb7u5 x86_64 GNU/Linux), which will monitor a specific port we have and when there is no process running on that port, or that port is available, then I will have to send out an email. I intend to run the script every 15 minutes and then send out an email.

We have an email-server and I want to add it’s configuration in the script, but I am not sure how I can do that.

When in Java, I am using the configuration in this manner :

JavaScript

Currently, I have the script as follows, any suggestions to script are also welcome. Thank you.

JavaScript

Thank you.

Advertisement

Answer

Both mailx and sendmail can send full e-mails from CLI; most systems feature both preinstalled.

Example with ‘mailx’:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement