freebsd-ports/sysutils/sge61/files/sge.sh.in
Doug Barton 1d6b4b3f91 Begin the process of deprecating sysutils/rc_subr by
s#. %%RC_SUBR%%#. /etc/rc.subr#
2010-03-27 00:15:24 +00:00

65 lines
1.7 KiB
Bash

#!/bin/sh
# $FreeBSD$
# PROVIDE: sge
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
# rc.conf variables:
#
# sge_cell The SGE_CELL for this machine (default=default).
# sge_qmaster_enable Start the qmaster and scheduler (default=NO).
# sge_execd_enable Start the exec daemon (default=NO).
. /etc/rc.subr
export SGE_ROOT=%%PREFIX%%/%%SGE_BASE%%
name="sge"
start_cmd="sge_start"
stop_cmd="sge_stop"
sge_start()
{
if checkyesno sge_qmaster_enable; then
${sgemaster_script} start
fi
if checkyesno sge_execd_enable; then
host=`hostname`
execd_spool_dir=${execd_spool_dir:-`${qconf} -sconf ${host} 2>/dev/null | awk '($1 == "execd_spool_dir") {print $2}'`}
execd_spool_dir=${execd_spool_dir:-`${qconf} -sconf global 2>/dev/null | awk '($1 == "execd_spool_dir") {print $2}'`}
if [ -n "${execd_spool_dir}" ]; then
mkdir -p ${execd_spool_dir}
mkdir -p ${execd_spool_dir}/${host%%.*}
mkdir -p ${execd_spool_dir}/${host%%.*}/active_jobs
mkdir -p ${execd_spool_dir}/${host%%.*}/jobs
mkdir -p ${execd_spool_dir}/${host%%.*}/job_scripts
chown -R sgeadmin ${execd_spool_dir}/${host%%.*}
fi
${sgeexecd_script} start
fi
}
sge_stop()
{
if checkyesno sge_execd_enable; then
${sgeexecd_script} stop
fi
if checkyesno sge_qmaster_enable; then
${sgemaster_script} stop
fi
}
load_rc_config $name
sge_qmaster_enable=${sge_qmaster_enable-NO}
sge_execd_enable=${sge_execd_enable-NO}
export SGE_CELL=${sge_cell:-default}
sgemaster_script=${SGE_ROOT}/${SGE_CELL}/common/sgemaster
sgeexecd_script=${SGE_ROOT}/${SGE_CELL}/common/sgeexecd
execd_spool_dir=${sge_execd_spool_dir-}
sge_arch=fbsd-`uname -m`
qconf=${SGE_ROOT}/bin/${sge_arch}/qconf
run_rc_command $*