#!/bin/bash
#
# Startup script for PVM 
#
# chkconfig: - 85 15
# description: PVM is Parallel Virtual Machine and provides the core of the \
#	       Beowulf cluster.
# processname: pvmd
# pidfile: /var/run/pvmd.pid

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

prog="pvmd3"
export PVM_ROOT=/usr/share/pvm3 
export PVMD_NOHOLD=ON
export PVM_TMP=/var/run/pvm3

start(){
    echo -n $"Starting $prog: "
    export PVM_ROOT=/usr/share/pvm3
    export PVMD_NOHOLD=ON
    rm -f /var/run/pvm3/* 2> /dev/null
    daemon --user pvm /usr/share/pvm3/lib/pvmd
    echo
    touch /var/lock/subsys/pvmd3
}

stop(){
    echo -n $"Stopping $prog: "
    killproc pvmd3
    rm -f /var/run/pvm3/* 2> /dev/null
    echo
    rm -f /var/lock/subsys/pvmd3
}

condrestart(){
    [ -e /var/lock/subsys/pvmd3 ] && restart || :
}
    


# See how we were called.
case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    status)
	status pvmd3
	;;
    restart)
	stop
	start
	;;
    condrestart)
	condrestart
	;;
    *)
	echo  $"Usage: $0 {start|stop|restart|status|condrestart}"
	exit 1
esac

exit 0
