ports/sysutils/condor/files/condor.in
Philip M. Gollucci 52e98e03cc sysutils/condor: update 8.2.6 -> 8.2.8
Update to latest stable release, canonicalize patch filenames, eliminate
GCC dependency and MAKE_JOBS_UNSAFE, replace files/condor_config.in with
version-specific example file provided in the dist, move sample files to
etc/*.sample, improvements to condor_config.local.sample and
condor-config script, make rc script more reliable by replacing fixed
sleep delays with more intelligent wait loops.

PR:                  200713
Submitted by:        jwbacon@tds.net (maintainer)
2015-07-10 04:07:17 +00:00

57 lines
1.4 KiB
Bash

#!/bin/sh
# PROVIDE: condor_master
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# condor_enable (bool): Set to NO by default.
# Set it to YES to enable condor.
#
. /etc/rc.subr
name="condor"
rcvar=condor_enable
pidfile=/var/run/${name}.pid
load_rc_config $name
: ${condor_enable="NO"}
start_cmd=condor_start
stop_cmd=condor_stop
condor_start() {
checkyesno condor_enable && echo "Starting condor_master." && \
%%PREFIX%%/sbin/condor_master ${condor_flags}
while ! ps ax | egrep -v 'grep|rc\.d' | grep -q condor; do
echo 'Waiting for daemons to start...'
sleep 2
done
}
condor_stop() {
# FIXME: condor_off with no arguments should be the same as
# -daemon master according to the man page, but it doesn't work
checkyesno condor_enable && echo "Stopping condor_master." && \
/usr/local/sbin/condor_off -daemon master
# Prevent restart command from issuing start before daemons are down
tries=1
while ps ax | egrep -v 'grep|rc\.d' | grep -q condor; do
echo 'Waiting for daemons to shut down...'
sleep 2
tries=$(($tries + 1))
if [ $tries = 10 ]; then
printf "condor_off has failed. Force killing condor_master...\n"
killall condor_master
sleep 2
fi
done
}
run_rc_command "$1"