スクリプト


起動スクリプト

#!/bin/bash
#
# Copyright (c) 2008-2009 Internet Initiative Japan Inc. All rights reserved.
#
# The terms and conditions of the accompanying program
# shall be provided separately by Internet Initiative Japan Inc.
# Any use, reproduction or distribution of the program are permitted
# provided that you agree to be bound to such terms and conditions.
#
# $Id: rc.enma-centos 882 2009-04-02 01:02:28Z takahiko $
#
# chkconfig: 345 79 31
# description: A milter program for domain authentication technologies

# source function library
. /etc/init.d/functions

RETVAL=0
prog=enma

ENMA=/usr/local/libexec/enma
CONF_FILE=/usr/local/etc/enma.conf
LOCK_FILE=/var/lock/subsys/enma


function start()
{
    echo -n $"Starting ${prog}: "
    #ulimit -n 65000      # The maximum number of open file descriptors
    #ulimit -s 512        # The maximum stack size
    ${ENMA} -c ${CONF_FILE} && success || failure
    RETVAL=$?
    [ ${RETVAL} -eq 0 ] && touch ${LOCK_FILE}
    echo
}

function stop()
{
    echo -n $"Stopping ${prog}: "
    killproc ${ENMA} -TERM
    RETVAL=$?
    [ ${RETVAL} -eq 0 ] && rm -f ${LOCK_FILE}
    echo
}

function restart()
{
    stop && sleep 5 && start
}


case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart|reload)
        restart
        ;;
   condrestart)
        [ -f ${LOCK_FILE} ] && restart
        ;;
    status)
        status ${ENMA}
        RETVAL=$?
        ;;
    *)
        echo "Usage: ${prog} {start|stop|restart|reload|condrestart|status}"
        RETVAL=1
        ;;
esac

exit ${RETVAL}

トップ   編集 凍結解除 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2010-12-30 (木) 12:46:19