#!/bin/sh -e

if [ -z $EDITOR ]; then
    EDITOR=vi
    export EDITOR
fi

for file in condor_config condor_config.local; do
    if [ ! -e /usr/local/etc/$file ]; then
	cp /usr/local/etc/$file.sample /usr/local/etc/$file
    fi
done

$EDITOR /usr/local/etc/condor_config.local

printf "Restart HTCondor? (y/[n]) "
read restart

if [ 0$restart = 0y ]; then
    service condor stop
    printf "\nCondor processes running after stop:\n\n"
    ps ax | grep condor

    service condor start
    printf "\nCondor processes running after start:\n\n"
    ps ax | grep condor
fi
