Linux服务器用户登录邮件告警
1,首先安装mailx工具用于发送邮件
yum -y install mailx 2,配置 mailx #This is the configuration file for Heirloom mailx (formerly #Sccsid @(#)nail.rc 2.11 (gritter) 8/2/08 #Do not forward to mbox by default since this is likely to be #Append rather than prepend when writing to mbox automatically. #Ask for a message subject. #Assume a CRT-like terminal and invoke a pager. #Messages may be terminated by a dot. #Do not remove empty mail folders in the spool directory. #Do not remove empty private mail folders. #Quote the original message in replies by "> " as usual on the Internet. #Automatically quote the text of the message that is responded to. #Outgoing messages are sent in ISO-8859-1 if all their characters are #Display sender‘s real names in header summaries. #Display the recipients of messages sent by the user himself in #Automatically check for new messages at each prompt,but avoid polling #If threaded mode is activated,automatically collapse thread. #Mark messages that have been answered. #Hide some header fields which are uninteresting for most human readers. #Only include selected header fields when forwarding messages. #For Linux and BSD,this should be set. set [email?protected] 3,测试mailx工具是否可以正常发送邮件 4,写入用户家目录下的环境变量文件中,这里测试的root用户 if [ -f /etc/bashrc ]; then 5,使配置配置文件生效并退出shell终端进行测试 6,重新登录测试 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |