-
-
Save jinzaizhichi/6a8dec29a090f60c5983e28219c3d630 to your computer and use it in GitHub Desktop.
Setting up Heirloom MailX to send emails from linux(Debian/ ubuntu) system:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir MailX | |
| cd MailX | |
| #Download file | |
| wget http://ftp.debian.org/debian/pool/main/h/heirloom-mailx/heirloom-mailx_12.5.orig.tar.gz | |
| #Download patch | |
| wget http://www.linuxfromscratch.org/patches/blfs/svn/heirloom-mailx-12.5-fixes-1.patch | |
| #unZip | |
| tar -xvzf heirloom-mailx_12.5.orig.tar.gz | |
| #Remove after unzipping | |
| rm -rf heirloom-mailx_12.5.orig.tar.gz | |
| #Run following commands | |
| patch -Np1 -i ../heirloom-mailx-12.5-fixes-1.patch && | |
| make SENDMAIL=/usr/sbin/sendmail -j1 | |
| #as a sudo user | |
| make PREFIX=/usr UCBINSTALL=/usr/bin/install install && | |
| ln -v -sf mailx /usr/bin/mail && | |
| ln -v -sf mailx /usr/bin/nail && | |
| install -v -m755 -d /usr/share/doc/heirloom-mailx-12.5 && | |
| install -v -m644 README /usr/share/doc/heirloom-mailx-12.5 | |
| #Append config file with BC smtp | |
| cat >> /etc/nail.rc <<EOF | |
| # set smtp=smtp://smtp.server.tld:port_number | |
| set smtp=smtp://smtp.emailsrvr.com | |
| # tell mailx that it needs to authorise | |
| set smtp-auth=login | |
| # set the user for SMTP | |
| set smtp-auth-user=bcsrvr@bluecava.com | |
| # set the password for authorisation | |
| set smtp-auth-password=RedSky123 | |
| EOF | |
| # Test MailX by sending a mail | |
| echo "hello world" | mail -s "a subject" sumeet@qualia-media.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| while true | |
| do | |
| [ $(free -m| grep Mem | awk '{ print int($3/$2*100) }') -gt "85" ] && echo "Memory used is more than 85% - GraphDB - SandBox " | mail -s "Memory used more than 85%" devops@bluecava.com || echo "Memory used less than 85%" | |
| sleep 600 | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| while true | |
| do | |
| if lsof -Pi :3000 -sTCP:LISTEN -t >/dev/null ; then | |
| echo "Aerospike Running" | |
| else | |
| echo "Aerospike PORT DOWN!!!: 3000 GraphDB" | mail -s "Aerospike PORT DOWN!!!: 3000 GraphDB" | |
| fi | |
| sleep 120 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment