#!/bin/sh # # sge_execd Gridengine execution daemon # # chkconfig: - 99 01 # description: The Gridexecution daemon starts and manages grid jobs ### BEGIN INIT INFO # Provides: sge_execd # Required-Start: $network $local_fs $remote_fs # Required-Stop: $network $local_fs $remote_fs # Should-Start: # Should-Stop: # Default-Start: # Default-Stop: 0 1 6 # Short-Description: Gridengine execution daemon # Description: The Gridexecution daemon starts and manages grid jobs ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions exec="/usr/bin/sge_execd" prog="sge_execd" #Defaults SGE_ROOT=/usr/share/gridengine SGE_CELL=default #Configuration config=/etc/sysconfig/gridengine [ -e $config ] && . $config #Export these export SGE_ROOT SGE_CELL utilbin_dir=/usr/libexec/gridengine/utilbin # UQHOST is the local host name (unqualified name) UQHOST=`$utilbin_dir/gethostname -name | cut -f1 -d.` execd_spool_dir=`/usr/bin/qconf -sconf $UQHOST 2>&- | awk '$1 == "execd_spool_dir" { print $2 }'` if [ -z "$execd_spool_dir" ]; then execd_spool_dir=`/usr/bin/qconf -sconf | awk '$1 == "execd_spool_dir" { print $2 }'` fi #Add the hostname to the spool directory execd_spool_dir=${execd_spool_dir}/${UQHOST} pidfile=${execd_spool_dir}/execd.pid lockfile=/var/lock/subsys/$prog start() { [ -x $exec ] || exit 5 #Set maximum locked memory, needed for infiniband support [ -n "$RLIMIT_MEMLOCKED" ] && ulimit -l $RLIMIT_MEMLOCKED echo -n $"Starting $prog: " daemon --check $prog --pidfile=$pidfile $exec retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc -p $pidfile $prog retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile if [ "$1" != "soft" ]; then for jobid in `ls $execd_spool_dir/active_jobs`; do echo " Shutting down Grid Engine shepherd of job $jobid" killproc -p $execd_spool_dir/active_jobs/$jobid/pid sge_shepherd done fi return $retval } restart() { stop soft start } reload() { restart } force_reload() { restart } rh_status() { # run checks to determine if the service is running or use generic status status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; softstop) rh_status_q || exit 0 stop soft ;; restart) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 restart ;; *) echo $"Usage: $0 {start|stop|softstop|status|restart|try-restart|reload|force-reload}" exit 2 esac exit $?