[Avcheck] kavdaemon init Skript

Ralf Hildebrandt Ralf.Hildebrandt@innominate.com
Wed, 15 Aug 2001 14:42:11 +0200


--MGu/vTNewDGZ7tmp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Am 15.08.2001 um 14:30:52 +0200 schrieb Fridtjof Busse folgendes:

> I wrote a similar script for redhat (only some other definitions and
> calls lie 'daemon' and 'killproc') and there is still one problem: What
> if you are running a second kavdaemon for file-scanning on the same
> system? You are killing this one also and it won't restart...
> OK, I could include a start script for this daemon too, but this is no
> real solution.

2nd try (attached). Please try if it kills just the chrooted instance
or all instances!

-- 
Ralf.Hildebrandt@innominate.com                           innominate AG
+49.(0)30.308806-62  fax: -77                         networking people
Any host that rejects 8bit mail for no particular reason other then
trying to enforce use of 7bit mail is stupid!


--MGu/vTNewDGZ7tmp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=kavdaemon

#! /bin/sh
#
# startup/shutdown script for kavdaemon for use with avpcheck.c
#

DAEMONNAME=kavdaemon
DAEMON=/var/spool/avp/kavdaemon

pid=`ps ax | awk '{print $1,$5}' | grep $DAEMONNAME | awk '{print $1}' | awk '{print $1}'`

# Start or stop based upon the first argument to the script.
case $1 in
	start | restart | reload)
	     	cd /var/spool/avp
		chmod 644 bases/*
		chmod 755 bases
		/usr/bin/env - HOME=/ \
		/var/spool/avp/uchroot -u avpd /var/spool/avp \
		./$DAEMONNAME -ka && \
		sleep 2 && \
		/usr/bin/env - HOME=/ \
		/var/spool/avp/uchroot -u avpd /var/spool/avp \
		./$DAEMONNAME -dl -MD -MP -dp -V -* -f=/ctl /tst 
		echo "$DAEMONNAME: (re)started."
	     	/usr/sbin/postconf -e "defer_transports ="
		/usr/sbin/postfix reload
		;;

	stop)
	     	/usr/sbin/postconf -e "defer_transports = avpcheck"
		/usr/sbin/postfix reload
	     	cd /var/spool/avp
		$DAEMON -ka && sleep 2
		echo "$DAEMONNAME: stopped."
		;;

	status)
		if test "$pid" != ""; then
			echo "$DAEMONNAME: is running."
		else
			echo "$DAEMONNAME: is not running."
		fi
		;;

	*)
		echo "Usage: $DAEMONNAME {reload|restart|start|status|stop}"
		exit 1
		;;
esac

exit 0


#
# end
#

--MGu/vTNewDGZ7tmp--