Calendar
数据载入中,请稍候......
Placard
数据载入中,请稍候......
Category
数据载入中,请稍候......
Latest Entries
数据载入中,请稍候......
Latest Comments
数据载入中,请稍候......
Last Messages
数据载入中,请稍候......
User Login
数据载入中,请稍候......
Links
Information
数据载入中,请稍候......
Search
Other


Welcome to my blog!
  postfix启动脚本
 
postfix启动脚本
#!/bin/sh
PATH=""
RETVAL=0
LOGGER="/usr/bin/logger"
POSTFIX="/usr/sbin/postfix"
if [ ! -f $POSTFIX ] ; then
    echo "Unable to locate Postfix"
    $LOGGER -t $0 -s -p mail.err "Unable to locate Postfix"
    exit 1
fi
if [ ! -f /etc/postfix/main.cf ] ; then
    echo "Unable to locate Postfix configuration"
    $LOGGER -t $0 -s -P mail.err "Unable to locate Postfix configuration" 
    exit 1
fi
case "$1" in
    start)
        echo -n "Starting Postfix: "
        /usr/sbin/postfix start > /dev/null 2>1
        RETVAL=$?
        echo
        ;;
    stop)
        echo -n "Stopping Postfix: "
        /usr/sbin/postfix stop > /dev/null 2>1
        RETVAL=$?
        echo
        ;;
    restart)
        echo -n "Restarting Postfix: "
        /usr/bin/postfix reload > /dev/null 2>1
        RETVAL=$?
        echo
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
        RETVAL=1
esac
exit $RETVAL
Place this script in /etc/rc.d/init.d or /etc/init.d, depending on your Linux distribution. Then make the appropriate symbolic links in each of the rcN.d directories for each runlevel in which Postfix should start (see "init, inittab, and rc Files" in Chapter 17). For example, if you want to have Postfix start at runlevels 3 and 5 and stop at runlevels 0 and 6, create symbolic links like those that follow for Red Hat. For Debian, the rcN.d directories are directly below /etc.
或者简单些的chkconfig --level 3 --Postfix(这个是新建的脚本名称,注意权限,我在测试时,好像这个不能用.)
# cd /etc/rc.d/rc3.d
# ln -s .../init.d/postfix S97postfix
# cd /etc/rc.d/rc5.d
# ln -s .../init.d/postfix S97postfix
# cd /etc/rc.d/rc0.d
# ln -s .../init.d/postfix K97postfix
# cd /etc/rc.d/rc6.d
# ln -s .../init.d/postfix K97postfix
[ 阅读全文 | 回复(0) | 引用通告 | 编辑

  Post  by  badboy 发表于 2007-8-1 10:54:00
发表评论:
数据载入中,请稍候......
数据载入中,请稍候......