Re: trend-update.pl preliminary v0.3 (/etc/init.d/trophie)

Alain Fauconnet <[email protected]> Fri, 26 Mar 2004 10:24:58 +0700
Newsgroups gmane.comp.security.virus.vtools
Message-ID <[email protected]>
Chris,

On Thu, Mar 25, 2004 at 03:58:02PM -0500, Covington, Chris wrote:
> Alain,
> 
> This is great!
> 
> It seems to work for me, except that I don't have a /etc/init.d/trophie
> script.  Would you mind sharing yours?

Not at all. It's not quite "mine" actually, it's a hacked  version  of
the one that comes with the Sophie RPM for Red Hat I think.
Note that I keep  my  Trophie  PID  file  in  a  nonstandard  location
(/var/amavis/trophie.pid) so I have to play some games to keep Red Hat
happy (it wants them in /var/run).

[script attached]

Greets,

_Alain_

_______________________________________________
vtools mailing list
[email protected]
http://www.vanja.com/list/listinfo.cgi/vtools
trophie (text/plain, 1.7 KB)
#!/bin/sh
#
# trophie:		Starts the Trend Linux Serverprotect daemonized front-end
#
# chkconfig: 345 78 22
# description:  Trophie is a daemonized front-end to the Trend Micro \
#		Linux Serverprotect virus scanner.
# processname: trophie
#

# Sanity checks.
[ -x /usr/local/sbin/trophie ] || exit 0

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

# See how we were called.
case "$1" in
    start)
        echo -n "Starting trophie: "
	/usr/local/sbin/trophie -D
	RETVAL=$?
	if [ $RETVAL -eq 0 ]; then
		success "trophie startup" 
		# Copy the trophie PID file where Red Hat expects PID files
		cp -f /var/amavis/trophie.pid /var/run/trophie.pid
	else
 		failure "trophie startup"
	fi
        echo
        touch /var/lock/subsys/trophie
	;;
    stop)
	echo -n "Stopping trophie: "
	# Kill trophie getting its PID from the PID file
	if [ -f /var/amavis/trophie.pid ]; then
		pid=`/bin/cat /var/amavis/trophie.pid`
		/bin/kill -15 $pid
		RETVAL=$?
		# Use brute force to kill remaining children
		/usr/bin/killall trophie
	else
		# No PID file? use brute force
		/usr/bin/killall trophie
		RETVAL=$?
	fi

	[ $RETVAL = 0 ] && success "trophie shutdown" || failure "trophie shutdown"
	rm -f /var/lock/subsys/trophie /var/run/trophie.pid /var/amavis/trophie.pid
	echo
	;;
  status)
        status trophie
	RETVAL=$?
        ;;
  restart)
        $0 stop
        $0 start
	RETVAL=$?
	;;
  condrestart)
	if [ -f /var/lock/subsys/trophie ]; then
            $0 stop
            $0 start
        fi
	;;
  reload)
  	if [ -f /var/amavis/trophie.pid ]; then
		pid=`/bin/cat /var/amavis/trophie.pid`
		/bin/kill -1 $pid
		RETVAL=$?
	fi
        ;;
    *)
	echo "Usage: $0 {start|stop|status|restart|reload}"
	;;
esac
exit $RETVAL