使用该脚本是一定要注意postfix安装路径

#!/bin/bash
#
# postfix Postfix Mail Transger Agent
#
# chkconfig:
# description: Postfix is a Mail Transport Agent, which is the program that moves mail from one machine to another
# processname: master
# pidfile /var/spool/postfix/pid/master.pid
# config: /etc/postfix/main.cf
# config: /etc/postfix/master.cf # Source function library.
source /etc/rc.d/init.d/functions # Source networking configuation.
source /etc/sysconfig/network # Check that networking is up.
[ $NETWORKING = "no" ] && exit [ -x /usr/sbin/postfix ] || exit
[ -d /etc/postfix ] || exit
[ -d /var/spool/postfix ] || exit RETVAL=
prog="postfix" start() {
# Start daemons .
echo -n $"Starting postfix: "
/usr/bin/newaliases >/dev/null >&
/usr/sbin/postfix start >/dev/null >& && success || failure $"$prog start"
RETVAL=$?
[ $RETVAL -eq ] && touch /var/lock/subsys/postfix
echo
return $RETVAL
} stop() {
# Stop daemons .
echo -n $"Shutting down postfix: "
/usr/sbin/postfix stop >/dev/null >& && success || failure $"$prog stop"
RETVAL=$?
[ $RETVAL -eq ] && rm -f /var/lock/subsys/postfix
echo
return $RETVAL
} reload() {
echo -n $"Reloading postfix: "
/usr/sbin/postfix reload >/dev/null >& && success || failure $"$prog reload"
RETVAL=$?
echo
return $RETVAL
} abort() {
/usr/sbin/postfix abort >/dev/null >& && success || failure $"$prog abort"
return $?
} flush() {
/usr/sbin/postfix flush >/dev/null >& && success || failure $"$prog flush"
return $?
} check() {
/usr/sbin/postfix check >/dev/null >& && success || failure $"$prog check"
return $?
} restart() {
stop
start
} # See how we were called
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
reload
;;
abort)
abort
;;
flush)
flush
;;
check)
check
;;
status)
status master
;;
condrestart)
[ -f /var/lock/subsys/postfix ] && restart || :
;;
*)
echo $"Usage:$0 {start|stop|restart|reload|abort|flush|check|status|condrestart}"
exit
esac exit $?
#END

赋予执行权限:

# chmod 755 /etc/rc.d/init.d/postfix

将postfix添加到服务列表

chkconfig --add postfix

设置开机自启动

# chkconfig postfix on

postfix启动脚本的更多相关文章

  1. gitlab6 nginx配置和启动脚本

    gitlab6 nginx配置和启动脚本 cheungmine 2013-10 最近把gitlab安装到了ubuntu12.04.3的虚拟机上了.参考: https://github.com/gitl ...

  2. Linux_自制系统服务启动脚本

    目录 目录 前言 Case语句 Apache 启动脚本 Postfix service 启停脚本 前言 在Linux的某些系统服务中,需要自己定制启动服务的脚本.通常会使用Cash语句来实现. Cas ...

  3. logstash服务启动脚本

    logstash服务启动脚本 最近在弄ELK,发现logstash没有sysv类型的服务启动脚本,于是按照网上一个老外提供的模板自己进行修改 #添加用户 useradd logstash -M -s ...

  4. 改进uwsgi启动脚本,使其支持多个独立配置文件

    最近在研究flask,在架设运行环境的时候犯了难.因为我想把每个独立的应用像NGINX处理多个网站那样,每个应用单独一个配置文件.而网上流传的uwsgi启动脚本都只支持单个配置文件.虽然有文章说可以把 ...

  5. linux nginx 启动脚本

    linux nginx 启动脚本 [root@webtest76 ~]# vi /etc/init.d/nginx #!/bin/bash # nginx Startup script for the ...

  6. busybox rootfs 启动脚本分析(二)

    上次分析了busybox的启动脚本,这次分析一下init.d中一些脚本的内容. 参考链接 http://www.cnblogs.com/helloworldtoyou/p/6169678.html h ...

  7. Tomcat启动脚本

    记录一个比较好的tomcat启动脚本,截取<OneinStack>,修改如下两个参数即可用. 使用之前修改下面2个参数: #Location of JAVA_HOME (bin files ...

  8. Linux Runlevel 启动 脚本

    Linux 操作系统自从开始启动至启动完毕需要经历几个不同的阶段,这几个阶段就叫做 Runlevel,同样,当Linux操作系统关闭时也要经历另外几个不同的 Runlevel,下面详细介绍一下 Run ...

  9. [Tomcat 源码分析系列] (二) : Tomcat 启动脚本-catalina.bat

    概述 Tomcat 的三个最重要的启动脚本: startup.bat catalina.bat setclasspath.bat 上一篇咱们分析了 startup.bat 脚本 这一篇咱们来分析 ca ...

随机推荐

  1. 学习mongo系列(十一)关系

    准备工作:首先在maxh数据库的address集合中先插入数据 > db.address.insert({child_address:"gansu"}) WriteResul ...

  2. java易错基础知识点

    一. Switch 1.其能接受的数据类型有四个,char , byte, short, int2.Default 可放在switch中的任何一个地方,但只有给定的条件匹配不到时,才会执行3.Case ...

  3. springMVC的两种下载方式

    1:通过httpServletResponse对象实现下载,觉得LOW的自行跳过 2:有人觉得既然使用的是MVC就要使用spring的方式

  4. Spring <bean> 参数意义

    1.id bean的唯一标识, 2.class 类的完全限定名, 3.parent 父类bean定义的名字. 如果没有任何声明,会使用父bean,但是也可以重写父类.重写父类时,子bean 必须与父b ...

  5. [分享] 从定制Win7母盘到封装详细教程 By BILL ( 10月23日补充说明 )

    [分享] 从定制Win7母盘到封装详细教程 By BILL ( 10月23日补充说明 ) billcheung 发表于 2011-10-23 00:07:49 https://www.itsk.com ...

  6. Django1.9开发博客(10)- 全文搜索

    Django本身不提供全文检索的功能,但django-haystack为其提供了全文检索的框架. django-haystack能为Django提供whoosh,solr,Xapian和Elastic ...

  7. windows下面安装casperjs

    因为需要 就学习了一下casperjs,CasperJS是一个开源的导航脚本处理和测试工具,基于PhantomJS(前端自动化测试工具)编写.由于casperjs对PhantomJS的依赖性,所以需要 ...

  8. sqlite数据类型

    sqlite数据类型(时间 日期 double等)     sqlite3支持的数据类型: NULL.INTEGER.REAL.TEXT.BLOB但是,sqlite3也支持如下的数据类型smallin ...

  9. 微信JS-SDK DEMO页面和示例代码

    <?php require_once "jssdk.php"; $jssdk = new JSSDK("yourAppID", "yourApp ...

  10. 网站优化之Asp.Net篇<一>

    一>禁用viewstate. 二>禁用动态编译.访问一个Aspx文件时 会编译为一个新的类放在C盘Asp.net临时文件夹下.下次请求不会再编译,会把先前的编译结果返回. 任何对Asp.n ...