From: Heiko Z. <smi...@us...> - 2010-09-28 18:14:49
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv26409/scripts/scripts Added Files: mailscanner Log Message: - added MailScanner-4.81.4-1 (Alberto Benati + Heiko) - updated DenyHosts to debian patch 2.6-7 (Alberto Benati / Heiko) - added missing perl module Sys-SigAction-0.11 - updated gradm to 2.2.0-201009022049 - updated grsecurity to 2.2.0-2.6.32.23-201009272133 - updated kernel to 2.6.32.23 --- NEW FILE: mailscanner --- #!/bin/bash # # $Source: /cvsroot/devil-linux/build/scripts/scripts/mailscanner,v $ # $Revision: 1.1 $ # $Date: 2010/09/28 18:14:41 $ # # http://www.devil-linux.org # ### BEGIN INIT INFO # Provides: mailscanner # Required-Start: $network $syslog $named clamav spamd # Required-Stop: $network $syslog $named # Default-Start: 3 5 # Default-Stop: 0 6 # Description: starts MailScanner ### END INIT INFO # settings source /etc/sysconfig/config # parameters NAME="MailScanner" CONFIGNAME=MAILSCANNER DAEMON=/usr/sbin/MailScanner CONFFILE=/etc/MailScanner/MailScanner.conf PARAMETER="" # source function library source /etc/init.d/functions eval START=\$START_$CONFIGNAME # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} # Force execution if not called by a runlevel directory. test $link = $base && START=yes test "$START" = "yes" || exit 0 if [ ! -e $DAEMON ]; then echo echo "$DAEMON not found. Did you install the package?" exit 1 fi # sanity check for permissions check_dir() { if [ ! -d $1 ]; then echo >&2 "$0: directory $1: does not exist" exit 1 fi actual="$(stat -c %U $1)" if [ "$actual" != "$2" ]; then echo >&2 "$0: directory $1: wrong owner (expected $2 but is $actual)" exit 1 fi actual="$(stat -c %G $1)" if [ "$actual" != "$3" ]; then echo >&2 "$0: directory $1: wrong group (expected $3 but is $actual)" exit 1 fi } pidfile=$(echo $(awk -F= '/^PID file/ {print $2; exit}' $CONFFILE)) mta=$(echo $(awk -F= '/^MTA/ {print $2; exit}' $CONFFILE)) user=$(echo $(awk -F= '/^Run As User/ {print $2; exit}' $CONFFILE)) group=$(echo $(awk -F= '/^Run As Group/ {print $2; exit}' $CONFFILE)) check_dir /var/spool/MailScanner ${user:-mail} ${group:-mail} case "$1" in start) echo -n "Starting $NAME: " if [ $mta = 'postfix' ]; then :> $pidfile chown $user $pidfile chown postfix /var/spool/MailScanner/incoming #chown postfix /var/spool/MailScanner/quarantine fi /usr/sbin/check_MailScanner >/dev/null RETVAL=$? if [ $RETVAL -eq 0 ]; then touch /var/lock/subsys/MailScanner rm -f /var/lock/subsys/MailScanner.off fi success echo "$NAME." ;; stop) echo -n "Stopping $NAME: " killproc MailScanner -15 RETVAL=$? if [ $RETVAL -eq 0 ]; then rm -f /var/lock/subsys/MailScanner touch /var/lock/subsys/MailScanner.off fi if ps axww | grep -i $DAEMON | grep -qv grep; then echo -n "(waiting" for i in 1 2 3 4 5 6 7 8 9 10; do sleep $i if ! ps axww | grep -i $DAEMON | grep -qv grep; then break; fi echo -n . done echo -n ") " fi rm -f $pidfile echo "$NAME." ;; reload) echo -n "Reloading $NAME: " pid=`pidof MailScanner` if [ -z "$pid" ] ; then failure else /bin/kill -HUP -- -$pid success fi echo if [ $mta = "postfix" ]; then service postfix reload 2>/dev/null success echo fi ;; restart) $0 stop $0 start ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|reload}" >&2 exit 1 ;; esac exit 0 |