postfix下的转发配置文件更改
#!/bin/bash
POSTCONF=‘/etc/postfix/main.cf‘ ##配置文件的位置
ret=$(grep smtp_idns_filter_style $POSTCONF |awk -F ‘=‘ ‘{print $2}‘) 切割出配置文件要更改的部分
echo "the current is $ret"
BASE=hongkong
# Start the hongkong
start ()
{
echo $"Starting $BASE:"
sed -i "s/smtp_idns_filter_style = none/smtp_idns_filter_style = exclude/g" $POSTCONF ##替换配置文件更改内容
ret=$(grep smtp_idns_filter_style $POSTCONF |awk -F ‘=‘ ‘{print $2}‘)
echo "the current change is $ret"
}
#Stop the hongkong
stop()
{
echo $"Stoping $BASE:"
sed -i "s/smtp_idns_filter_style = exclude/smtp_idns_filter_style = none/g" $POSTCONF
ret=$(grep smtp_idns_filter_style $POSTCONF |awk -F ‘=‘ ‘{print $2}‘)
echo "the current change is $ret"
}
case $1 in
start)
start 调用start()函数
/etc/init.d/postfix reload 加载配置文件
;;
stop)
stop
/etc/init.d/postfix reload
;;
*)
echo $"Usage: $0 {start|stop}."
exit 1
esac
exit 0