#! /bin/csh -f
#
# Copyright (c) 1993-1996 CheckPoint Software Technologies Ltd.
# All Rights Reserved
#
# THIS IS AN UNPUBLISHED PROPRIETARY SOURCE CODE OF CHECKPOINT SOFTWARE
# TECHNOLOGIES LTD. The copyright notice above does not evidence any actual
# or intended publication of such source code.
#
# $Header: /fw/cvs/fw-1/fwutil/fwstop.csh,v 1.11.2.1 1996/04/11 09:59:18 yoav Exp $
#
if (! $?FWDIR) setenv FWDIR /etc/fw
set path = ( $FWDIR/bin /bin /usr/bin /etc /usr/etc )
set fwunload
fw kill fwd
fw kill snmpd
fw kill fwm
fw kill in.ahttpd >& /dev/null
if (-f /kernel/genunix || -f /kernel/unix || -f /hp-ux || -f /stand/vmunix) then
	fw isonlycontrol >& /dev/null
	if ($status) then
		fw unload all.all >& /dev/null
	else
		fw unload all.all
	endif
	fw ctl uninstall
	goto no_modunload
endif
set id = `modstat |  awk 'BEGIN { found = 1; } { for(i = 2; i <= NF; i++) if($i == "fw") { print $1; found = 0; }} END { exit found; }'`
if ($status) then
	echo 'fwstop: Module not loaded'
	exit 1
endif
sleep 2
echo 'FW: Unloading kernel module'
modunload -id $id

no_modunload:

exit 0
