Command Line:
- Check if sendmail is running => ps ax | grep sendmail
- Check if sendmail is running => /etc/init.d/sendmail status
- Check sendmail listening info (IP and port) => netstat -tnlp | grep sendmail
- Send email (please use man mail for user guide)
- mail -s "Email subject" example@example.com < /tmp/test.txt
- cat /tmp/test.txt | mail -s "Email subject" example@example.com
- echo "The message in email body" | mail -s "Email subject" example@example.com
- (df -h;free -m) | mail -s "Disk and Memory Info" example@example.com
- less /proc/cpuinfo | mail -s "CPU Info" example@example.com -c ccto@example.com
#!/bin/sbin
#df -h | mail -s "disk space" example@example.com
#!/bin/bash
df -h > /tmp/mail_report.log
free -m >> /tmp/mail_report.log
mail -s "disk and RAM report" example@example.com < /tmp/mail_report.log
rm -f /tmp/mail_report.log
No comments:
Post a Comment