postfix一键部署
Posted dccrussell
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了postfix一键部署相关的知识,希望对你有一定的参考价值。
#!/bin/bash #author:dcc #date:2018/05/26 #version:v1 #description:install postfix if [ ! -d "$HOME/mylog" ];then mkdir $HOME/mylog fi config_file="/etc/postfix/main.cf" log_path="$HOME/mylog/install.log" #check postfix whether install rpm -q postfix >/dev/null if [ ! $? -eq 0 ];then #test yum whether can use? test01=`yum repolist | grep ‘repolist: ‘|sed -n ‘s/repolist: //p‘` if [ "$test01" == "0" ];then echo "error_code:1;the yum.repo can‘t be used" >> $log_path echo "Error:yum can not be used" exit 1 fi yum -y install postfix > /dev/null && echo "`date`:install postfix success" >> $log_path || echo "`date`:install postfix failed" && exit 1 fi #config postfix sed -in ‘/^mydestination =/s/=.*/=/‘ $config_file sed -rin ‘/^#myori.*hostname$/cmyorigin = dcc.cn‘ $config_file #restart and enable postfix systemctl restart postfix && echo "`date`:restart postfix success" >> $log_path || echo "`date`:restart postfix failed,you can use journalctl -xe to check" >> $log_path && exit 2 systemctl enable postfix && echo "`date`:enable postfix success" >> $log_path || echo "`date`:enable postfix failed" >> $log_path && exit 3
不接受任何邮件,只用于发报警邮件
以上是关于postfix一键部署的主要内容,如果未能解决你的问题,请参考以下文章