欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

解决mail: command not found

解决mail: command not found

post by rocdk890 / 2013-7-29 17:09 Monday linux技术
 
 解决mail: command not found
 今天使用脚本来监控系统状态,为了把每天系统状态记录下来并发到邮箱里,我写了个脚本来实现,但在发邮件的过程中出现了mail: command not found.
 系统:centos 5.9
脚本内容:
 
#!/bin/bash
dug=$(df -h | grep "/$" | awk '{print $4}' | awk -F% '{print $1}')
cug=$(expr 100 - $(mpstat | tail -1 | awk '{print $10}' | awk -F. '{print $1}'))
mug=$(expr $(free | grep "cache:" | awk '{print $3}') \* 100 / $(free | grep "Mem:" | awk '{print $2}'))
alog="/root/alert.txt"
AMAIL="root@localhost.localdomain"
if [ $dug -gt 3 ]
then
echo "Disk usage:$dug%" >> $alog
fi
if [ $cug -gt 2 ]
then
echo "cpu usage:$cug%" >> $alog
fi
if [ $mug -gt 2 ]
then
echo "Memory usage:$mug%" >> $alog
fi
if [ -f $alog ]
then
cat $alog | mail -s "Host Alert" $AMAIL
rm -fr $alog
fi
 
 
解决办法:
yum -y install mailx sysstat

来自 http://blog.slogra.com/post-412.html

近日,安装了一个最小化的centos 6.2 64bit,系统中显示有root用户的mail,想用mail命令查看相关信件,
但发现一个问题:
-bash: mail: command not found
呵呵,显然mailx没有安装,于是:
yum -y install mailx

然后whois命令也没有

yum -y install jwhois

本文出自 “技术成就梦想” 博客,转载请与作者联系!

来自 http://hxl2009.blog.51cto.com/779549/884569


 

 

mail command not found

分类: 开发 986人阅读 评论(0) 收藏 举报

http://sharadchhetri.com/2013/02/13/mail-command-not-found-in-redhat-centos-or-ubuntu/

 

 

mail command not found

Whenever any message says while hitting the command as Command Not Found , it means the package is not installed or script is not present.
For the mail command not found issue install the mailx.
Use the below given command for mailx installation.

For Redhat/CentOS =>

yum install mailx

For Debian or Ubuntu =>

sudo apt-get install mailutils

来自 http://blog.csdn.net/cheng_fangang/article/details/9493585
http://m.blog.csdn.net/blog/chengfangang/9493585



 


 


普通分类: