スクリプト


起動スクリプト(clamd)

#! /bin/bash
#
# clamd   Start/Stop the clam antivirus daemon.
#
# chkconfig: 2345 70 41
# description: clamd is a standard Linux/UNIX program that scans for Viruses.
# processname: clamd
# config: /usr/local/etc/clamd.conf
# pidfile: /var/lock/subsys/clamd

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

RETVAL=0

# See how we were called.

prog="clamd"
progdir="/usr/local/sbin"

# Source configuration
if [ -f /etc/sysconfig/$prog ] ; then
        . /etc/sysconfig/$prog
fi

start() {
        echo -n $"Starting $prog: "
        daemon $progdir/$prog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        # Would be better to send QUIT first, then killproc if that fails
        killproc $prog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd
        return $RETVAL
}

rhstatus() {
        status clamd
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading clam daemon configuration: "
        killproc clamd -HUP
        retval=$?
        echo
        return $RETVAL
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  status)
        rhstatus
        ;;
  condrestart)
        [ -f /var/lock/subsys/clamd ] && restart || :
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
        exit 1
esac

exit $?

起動スクリプト(freshclam)

#! /bin/bash
#
# freshclam   Start/Stop the clam antivirus virus pattern check daemon.
#
# chkconfig: 2345 70 41
# description: freshclam is a virus pattern checker for clam antivirus.
# processname: freshclam
# config: /usr/local/etc/freshclam.conf
# pidfile: /usr/local/var/freshclam.pid

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

RETVAL=0

# See how we were called.

prog="freshclam"
progdir="/usr/local/bin"

# Source configuration
if [ -f /etc/sysconfig/$prog ] ; then
        . /etc/sysconfig/$prog
fi

start() {
        echo -n $"Starting $prog: "
        daemon $progdir/$prog -d -c 4 --quiet
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/freshclam
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        # Would be better to send QUIT first, then killproc if that fails
        killproc $prog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/freshclam
        return $RETVAL
}

rhstatus() {
        status freshclam
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading freshclam daemon configuration: "
        killproc freshclam -HUP
        retval=$?
        echo
        return $RETVAL
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  status)
        rhstatus
        ;;
  condrestart)
        [ -f /var/lock/subsys/freshclam ] && restart || :
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
        exit 1
esac

exit $?

logrotateスクリプト

/var/log/clamd.log {
        monthly
        notifempty
        missingok

        postrotate
                killall -HUP clamd 2>/dev/null || :
        endscript
}
/var/log/freshclam.log {
        monthly
        notifempty
        missingok

        postrotate
                killall -HUP freshclam 2>/dev/null || :
        endscript
}

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