-------- Do not delete this line, awk uses it ---------------------
CSH

if ( $#argv != 1 ) then
    echo Usage: condor_throttle number
    exit
endif

set CONFIG_VAL=$RELEASEDIR/bin/config_val
set LOCAL_CONFIG_FILE=`$CONFIG_VAL LOCAL_CONFIG_FILE`

grep ^MAX_JOBS_RUNNING $LOCAL_CONFIG_FILE >& /dev/null || \
	echo MAX_JOBS_RUNNING >> $LOCAL_CONFIG_FILE

echo "Reconfiguring to run $1 jobs... "

CMNT note: "ex" leaves symbolic links intact, while "ed" replaces them
ex - $LOCAL_CONFIG_FILE << EOF
/^MAX_JOBS_RUNNING/c
MAX_JOBS_RUNNING = $1
.
x
EOF

echo "The new situation:"
grep ^MAX_JOBS_RUNNING $LOCAL_CONFIG_FILE

chown condor $LOCAL_CONFIG_FILE
chgrp condor $LOCAL_CONFIG_FILE

echo Informing the Condor job scheduler...
$RELEASEDIR/bin/condor_reconfig_schedd
