栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

mail服务器安装脚本

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

mail服务器安装脚本

#!/bin/bash
domain='aaaaa.com'
check_env() {
  local timeout=1
  local target=www.baidu.com
  local ret_code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1`
  if [ $ret_code = 200 ]; then
    return 1
  else
    return 0
  fi
  #return 0
}
installmail() {
  check_env
  if [ $? -eq 0 ];then
    echo 'The servers network is faild!'
    exit -1
  else
    yum -y install epel* wget yum-utils
    hostnamectl set-hostname mail.${domain}
    echo '127.0.0.1 mail.'${domain}'' >>/etc/hosts
    yum -y install postfix.x86_64 dovecot.x86_64  cyrus-sasl
    local Mail_data=/data/Maildir
    if [ ! -d ${Mail_data} ];then
      mkdir -p ${Mail_data}
      yum -y install postfix.x86_64 dovecot.x86_64  cyrus-sasl
      systemctl restart saslauthd.service
      systemctl restart postfix.service
      systemctl restart dovecot.service
    fi
  fi
}

main() {
  installmail
}
main "$@"

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/676249.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号