#!/bin/bash

PATH=/bin:/usr/bin:/sbin:/usr/sbin

RUNLEVEL=`runlevel|cut -d ' ' -f 2`

for PROCESS in bgpd ospfd; do
    if [ "x$PROCESS" != "x" ]; then
	if [ ! -e /etc/rc.d/rc${RUNLEVEL}.d/S??$PROCESS -a -e /etc/rc.d/rc${RUNLEVEL}.d/K??$PROCESS ]; then
	    initlog -s "$PROCESS in not activated on runlevel $RUNLEVEL, skipping"
	elif [ ! -e /etc/rc.d/init.d/$PROCESS ]; then
	    initlog -s "$PROCESS in not installed, skipping"
	else
	    /etc/rc.d/init.d/$PROCESS stop
	fi
    fi
done
exit 0
