[torqueusers] init scripts for SuSE Linux

Martin Siegert siegert at sfu.ca
Sat Apr 15 12:22:05 MDT 2006


Hi Bernard,

On Sat, Apr 15, 2006 at 02:33:40AM -0700, Bernard Li wrote:

>    Does anybody have working init scripts for SuSE Linux?

Here is what I am using (the initscripts go into /etc/init.d, the
torque.conf file into /etc, and you need to do a "insserv torque").

Cheers,
Martin

-- 
Martin Siegert
Head, HPC at SFU
WestGrid Site Manager
Academic Computing Services                        phone: (604) 291-4691
Simon Fraser University                            fax:   (604) 291-4242
Burnaby, British Columbia                          email: siegert at sfu.ca
Canada  V5A 1S6
-------------- next part --------------
#!/bin/sh 
#
#    TORQUE init script
#
#	Reconized arguments:
#	    start   - start TORQUE
#	    stop    - terminate TORQUE
#	    restart - terminate and start TORQUE
#	    status  - report TORQUE deamon pids
#
#
# chkconfig: 2345 90 10
#
### BEGIN INIT INFO
# Provides: torque pbs
# Required-Start: $network xntpd
# X-UnitedLinux-Should-Start:
# Required-Stop:
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: The Portable Batch System (PBS) is a flexible workload
# management  system. It operates on networked, multi-platform UNIX
# environments, including heterogeneous clusters of workstations,
# supercomputers, and massively parallel systems.
### END INIT INFO

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status

conf=${PBS_CONF_FILE:-/etc/torque.conf}

if [ -f "${conf}" ] ; then
  . "${conf}"
  if [ -z "${PBS_START_SERVER}" ] ; then
      PBS_START_SERVER=0
  fi
  if [ -z "${PBS_START_MOM}" ] ; then
      PBS_START_MOM=0
  fi
  if [ -z "${PBS_START_SCHED}" ] ; then
      PBS_START_SCHED=0
  fi
  # UNIX95=1
  # export UNIX95
else
  echo "***"
  echo "*** Cannot find PBS configuration file: ${conf}"
  echo "***"
  exit 1
fi

start_torque() {
    echo "Starting TORQUE"

    if [ "${PBS_START_SERVER}" -gt 0 ] ; then
	/etc/init.d/torque_server start
    fi
  
    if [ "${PBS_START_MOM}" -gt 0 ] ; then
	/etc/init.d/torque_mom start
    fi
    if [ "${PBS_START_SCHED}" -gt 0 ] ; then
 	/etc/init.d/torque_sched start
#	/etc/init.d/moab start
    fi
}

stop_torque() {
    echo "Stopping TORQUE"
    if [ "${PBS_START_SERVER}" -gt 0 ] ; then
	/etc/init.d/torque_server stop
    fi
    if [ "${PBS_START_MOM}" -gt 0 ] ; then
	/etc/init.d/torque_mom stop
    fi
    if [ "${PBS_START_SCHED}" -gt 0 ] ; then
	/etc/init.d/torque_sched stop
#	/etc/init.d/moab stop
    fi
}

status_torque() {
    if [ "${PBS_START_SERVER}" -gt 0 ] ; then
	/etc/init.d/torque_server status
    fi
    if [ "${PBS_START_MOM}" -gt 0 ] ; then
	/etc/init.d/torque_mom status
    fi
    if [ "${PBS_START_SCHED}" -gt 0 ] ; then
	/etc/init.d/torque_sched status
#	/etc/init.d/moab status
    fi
}

# main code

case "$1" in
  status) status_torque ;;
  start) start_torque ;;
  stop) stop_torque ;;
  restart) echo "Restarting TORQUE" ; stop_torque ; start_torque ;;
  *) echo "Usage: `basename $0` {start|stop|restart|status}" ; exit 1 ;;
esac
-------------- next part --------------
#!/bin/sh
#
# torque_server    This script will start and stop the PBS Server
#
# chkconfig: 345 85 85
# description: PBS is a batch versatile batch system for SMPs and clusters
#
# processname: pbs_server
# config: /etc/torque.conf
#
# Source the library functions
. /etc/rc.status
# reset status of this service
rc_reset

if [ -f /etc/torque.conf ] ; then
. /etc/torque.conf
else
  echo -n -E "Can not find /etc/torque.conf\n"
  exit 1
fi

PID_FILE="${PBS_HOME}/server_priv/server.lock"
# let see how we were called
case "${1}" in
        start) 
                echo -n -E "Starting PBS Server: "
		PBS_SERVER_OPTIONS=""
		if [ -r /etc/sysconfig/torque_server ]; then
			. /etc/sysconfig/torque_server
		fi
                if [ -r ${PBS_HOME}/server_priv/serverdb ]
                then
 			startproc ${PBS_EXEC}/sbin/pbs_server $PBS_SERVER_OPTIONS
			RETVAL=$?
		        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pbs_server
                else
                        startproc ${PBS_EXEC}/sbin/pbs_server -t create $PBS_SERVER_OPTIONS
			RETVAL=$?
		        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pbs_server
                fi
                [ $RETVAL -eq 0 ] && ln -sf $PID_FILE /var/run/pbs_server.pid
		if [ $RETVAL -eq 0 ]; then
                	echo $rc_done
                else
                	echo $rc_failed
		fi
                ;;
        stop)
                echo -n -E "Shutting down PBS Server: "
                killproc pbs_server
		RETVAL=$?
		[ $RETVAL -eq 0 ] && rm -rf /var/lock/subsys/pbs_server
		if [ $RETVAL -eq 0 ]; then
			echo $rc_done
		else
			echo $rc_failed
		fi
                ;;
        status)
                echo -n "Checking for PBS Server: "
		checkproc pbs_server
	        rc_status -v
                ;;
        restart)
                ${0} stop
                ${0} start
		rc_status
                ;;
	reload)
                echo -n -E "Re-reading pbs_server config file"
                killproc pbs_server -HUP
		rc_status -v
		;;
        *)
                echo -n -E "Usage: pbs_server {start|stop|restart|reload|status}\n"
                exit 1
esac
-------------- next part --------------
#!/bin/sh
#
# torque_mom       This script will start and stop the TORQUE Mom
#
# chkconfig: 345 85 85
# description: PBS is a batch versatile batch system for SMPs and clusters
#
# processname: torque_mom
# config: /etc/torque.conf

ulimit -n 32768
# Source the library functions
. /etc/rc.status
# reset status of this service
rc_reset

if [ -f /etc/torque.conf ] ; then
. /etc/torque.conf
else
  echo "Can not find /etc/torque.conf"
  exit 1
fi

PID_FILE=${PBS_HOME}/mom_priv/mom.lock
# let see how we were called
case "$1" in
        start) 
                echo -n "Starting PBS Mom: "
                startproc $PBS_EXEC/sbin/pbs_mom -r
		rc_status -v
                RETVAL=$?
                [ $RETVAL -eq 0 ] && \
			(touch /var/lock/subsys/pbs_mom; \
			ln -sf $PID_FILE /var/run/pbs_mom.pid)
                ;;
        stop)
                echo -n "Shutting down PBS Mom: "
                killproc pbs_mom
		rc_status -v
		RETVAL=$?
		[ $RETVAL -eq 0 ] && rm -rf /var/lock/subsys/pbs_mom
                ;;
        status)
                checkproc pbs_mom
		rc_status -v
		RETVAL=$?
                ;;
        restart)
                $0 stop
		$0 start
		rc_status
		RETVAL=$?
                ;;
        reload)
                echo "Re-reading pbs_mom config file"
                killproc -HUP pbs_mom
		rc_status -v
                RETVAL=$?
                ;;
        *)
                echo "Usage: torque_mom {start|stop|restart|reload|status}\n"
                exit 1
esac
exit $RETVAL
-------------- next part --------------
#!/bin/sh
#
# torque_sched     This script will start and stop the PBS Scheduler
#
# chkconfig: 345 85 85
# description: PBS is a batch versatile batch system for SMPs and clusters
#
# processname: pbs_sched
# config: /etc/torque.conf
#
# Source the library functions
. /etc/rc.d/init.d/functions

if [ -f /etc/torque.conf ] ; then
. /etc/torque.conf
else
  echo "Can not find /etc/torque.conf"
  exit 1
fi

PID_FILE="/var/spool/torque/sched_priv/sched.lock"
# let see how we were called
case "${1}" in
        start) 
                echo -n "Starting PBS Scheduler: "
                daemon ${PBS_EXEC}/sbin/pbs_sched
                RETVAL=$?
		[ $RETVAL -eq 0 ] && (touch /var/lock/subsys/pbs_sched; \
                                      ln -sf $PID_FILE /var/run/pbs_sched.pid)
                echo
                ;;
        stop)
                echo -n "Shutting down PBS Scheduler: "
                killproc pbs_sched
                RETVAL=$?
		[ $RETVAL -eq 0 ] && rm -rf /var/lock/subsys/pbs_sched
                echo
                ;;
        status)
                status pbs_sched
                RETVAL=$?
                ;;
        restart)
                ${0} stop
                ${0} start
                RETVAL=$?
                ;;
	reload)
                echo "Re-reading pbs_sched config file"
		pbs_sched_pid=${PBS_HOME}/sched_priv/sched.lock
                killproc pbs_sched -HUP 
		RETVAL=$?
		;;
        *)
                echo -n -E "Usage: pbs_sched {start|stop|restart|status}\n"
                exit 1
esac
-------------- next part --------------
#!/bin/sh
# init of some var needed by pbs service
# config: /etc/torque.conf

PBS_HOME=/var/spool/torque
PBS_EXEC=/usr/local/torque
export PATH=${PBS_EXEC}/sbin:${PBS_EXEC}/bin:$PATH
PBS_SERVER=r1
echo $PBS_SERVER > ${PBS_HOME}/server_name
PBS_USER=torque
# set 1 to start the service
PBS_START_SERVER=1
PBS_START_MOM=0
PBS_START_SCHED=0
# LOGLEVEL (between 0 - 10)
export PBSLOGLEVEL=6


More information about the torqueusers mailing list