#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
    need net
    before EXE
}

DAEMON=/usr/bin/daemon
FE_PGIDFILE=/var/run/MiG_FE.pgid
FE_BINARY=/usr/bin/start_fe.sh

start() {
	ebegin "Starting ${SVCNAME}"
	    if test -f ${FE_PGIDFILE} 
	    then
    	       eerror "${SVCNAME} already started"
    	       return 1
    	    else
    	       ${DAEMON} "${FE_BINARY}" "${FE_PGIDFILE}" &
    	    fi
	eend $?  
}

stop() {
        ebegin "Stopping ${SVCNAME}"
	    if ! test -f ${FE_PGIDFILE}
	    then
	       eerror "${SVCNAME} not started"
	       return 1
	    else
	       # Kill all processes in group,
	       # to make sure alle MiG scripts are killed.
	       kill -9 -`cat ${FE_PGIDFILE}`
	       rm -f ${FE_PGIDFILE}
	    fi
	eend $?
}
