#!/bin/sh

# Condor boot time startup script for Darwin/Mac OS X. Copy this
# directory with all of its files to /Library/StartupItems.

######################### SET UP VARIABLES ####################################

# Installation prefix
prefix=/Users/condor/condor

# Which user to run condor_master as
CONDORUSER=condor

# Location of condor_config
CONDOR_CONFIG=/Users/condor/condor_config

######################## RUN THE SCRIPT ########################################

# The path that is to be used for the script
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/Users/condor/condor/bin:/Users/condor/condor/sbin

# What to use to start up the master
ON="$prefix/sbin/condor_master"
OFF="$prefix/sbin/condor_off -master" 

. /etc/rc.common

case $1 in
    start)
        ConsoleMessage "Starting Condor"
	su $CONDORUSER -c $ON
        ;;
    stop)
	ConsoleMessage "Stopping Condor"
	su $CONDORUSER -c $OFF
	;;
    *)
        # Print help
        echo "Usage: `basename $0` {start}"
        exit 1
        ;;
esac

exit 0
