Initial Torque support.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1016 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
datajerk 2008-04-10 19:14:14 +00:00
parent 824e24d090
commit 929f8dfe1a
22 changed files with 3651 additions and 0 deletions

View File

@ -0,0 +1,112 @@
#!/bin/bash
MYNAME=$(basename $0)
function usage {
echo
echo "Usage: $MYNAME netboot_rootdir TORQUE_SERVER [Torque Prefix, e.g. /opt/torque] [arch, e.g. x86_64] [local|nfs]"
echo
echo "e.g."
echo
echo "$MYNAME /install/netboot/fedora8/x86_64/compute/rootimg $(hostname -s) /opt/torque x86_64 local"
echo
}
case "$#" in
5)
ROOTDIR=$1
TORQUESERVER=$2
TPRE=$3
TORQUEDIR=$3
TARCH=$4
XARCH=$4
LOCALNFS=$5
;;
*)
usage >&2
exit 1
;;
esac
if [ -z "$XCATROOT" ]
then
echo "${MYNAME}: XCATROOT no defined" >&2
exit 1
fi
if [ ! -d $ROOTDIR ]
then
echo "${MYNAME}: root image $ROOTDIR does not exist" >&2
exit 1
fi
if [ "$LOCALNFS" = "local" ]
then
if [ ! -d "$TPRE/$TARCH/bin" ]
then
echo "${MYNAME}: cannot read $TPRE/$TARCH/bin" >&2
exit 1
fi
if [ ! -d "$TPRE/$TARCH/lib" ]
then
echo "${MYNAME}: cannot read $TPRE/$TARCH/lib" >&2
exit 1
fi
if [ ! -d "$TPRE/$TARCH/sbin" ]
then
echo "${MYNAME}: cannot read $TPRE/$TARCH/sbin" >&2
exit 1
fi
find $TPRE/$TARCH -print | cpio -v -dump $ROOTDIR
echo "$TPRE/$TARCH/lib" >$ROOTDIR/etc/ld.so.conf.d/torque.conf
chroot $ROOTDIR /sbin/ldconfig
else
echo "$TPRE/$TARCH/lib" >$ROOTDIR/etc/ld.so.conf.d/torque.conf
fi
cd $ROOTDIR
mkdir -p var/spool/pbs
chmod 755 var var/spool var/spool/pbs
cd var/spool/pbs
mkdir -p aux checkpoint mom_logs mom_priv spool undelivered
chmod 777 spool undelivered
chmod o+t spool undelivered
chmod 755 aux mom_logs
chmod 751 mom_priv
cd mom_priv
mkdir -p jobs
chmod 751 jobs
cp -f $XCATROOT/share/xcat/netboot/add-on/torque/scripts/* .
echo "\$logevent 0x1ff" >config
echo "\$clienthost $TORQUESERVER" >>config
chmod 644 config
cd ..
echo "PATH=/bin:/usr/bin" >pbs_environment
echo "LANG=en_US" >>pbs_environment
echo "$TORQUESERVER" >server_name
chmod 644 pbs_environment server_name
cd $ROOTDIR
>etc/profile.d/torque.sh
echo "export XARCH=\$(uname -m)" >>etc/profile.d/torque.sh
echo "export PATH=\$PATH:$TORQUEDIR/\$XARCH/bin:$TORQUEDIR/\$XARCH/sbin" >>etc/profile.d/torque.sh
echo "export PBS_DEFAULT=$TORQUESERVER" >>etc/profile.d/torque.sh
chmod 755 etc/profile.d/torque.*
if [ -r /etc/SuSE-release ]
then
cp $XCATROOT/share/xcat/netboot/add-on/torque/pbs_mom.suse etc/init.d/pbs_mom
cp $XCATROOT/share/xcat/netboot/add-on/torque/pbs_mom.suse sbin/rcpbs_mom
perl -pi -e "s!/opt/torque!$TORQUEDIR!g" sbin/rcpbs_mom etc/init.d/pbs_mom
else
cp $XCATROOT/share/xcat/netboot/add-on/torque/pbs_mom etc/rc.d/init.d/
perl -pi -e "s!/opt/torque!$TORQUEDIR!g" etc/rc.d/init.d/pbs_mom
fi
cd /tmp
chroot $ROOTDIR /sbin/chkconfig --level 345 pbs_mom on
chroot $ROOTDIR /sbin/chkconfig --list pbs_mom

View File

@ -0,0 +1,50 @@
#!/bin/sh
#
# moab This script will start and stop the MOAB Scheduler
#
# chkconfig: 345 86 84
# description: moab
#
# Source the library functions
. /etc/rc.d/init.d/functions
MOAB_PREFIX=/opt/moab
ARCH=$(uname -m)
export LD_LIBRARY_PATH=/opt/torque/x86_64/lib
# let see how we were called
case "$1" in
start)
echo -n "Starting MOAB Scheduler: "
if [ -r $MOAB_PREFIX/bin/moab ]
then
daemon $MOAB_PREFIX/bin/moab
elif [ -r $MOAB_PREFIX/sbin/moab ]
then
daemon $MOAB_PREFIX/sbin/moab
elif [ -r $MOAB_PREFIX/$ARCH/bin/moab ]
then
daemon $MOAB_PREFIX/$ARCH/bin/moab
elif [ -r $MOAB_PREFIX/$ARCH/sbin/moab ]
then
daemon $MOAB_PREFIX/$ARCH/sbin/moab
fi
echo
;;
stop)
echo -n "Shutting down MOAB Scheduler: "
killproc moab
echo
;;
status)
status moab
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: moab {start|stop|restart|status}"
exit 1
esac

View File

@ -0,0 +1,112 @@
#! /bin/sh
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
# Copyright (c) 2001 IBM
#
# Author: Kurt Garloff <feedback@suse.de>
# Author: Egan Ford <egan@us.ibm.com
#
# init.d/moab
#
# and symbolic its link
#
# /usr/sbin/rcmoab
#
# System startup script for the nessus backend nessusd
#
### BEGIN INIT INFO
# Provides: moab
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start moab to allow XY and provide YZ.
### END INIT INFO
if [ -r /etc/rc.config ]
then
. /etc/rc.config
fi
if [ -r /etc/sysconfig/xcat ]
then
. /etc/sysconfig/xcat
fi
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
MOAB_PREFIX=/opt/moab
ARCH=$(uname -m)
# 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_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting MOAB Scheduler: "
if [ -r $MOAB_PREFIX/bin/moab ]
then
startproc $MOAB_PREFIX/bin/moab -C $MOAB_PREFIX/moab.cfg
elif [ -r $MOAB_PREFIX/sbin/moab ]
then
startproc $MOAB_PREFIX/sbin/moab -C $MOAB_PREFIX/moab.cfg
elif [ -r $MOAB_PREFIX/$ARCH/bin/moab ]
then
startproc $MOAB_PREFIX/$ARCH/bin/moab -C $MOAB_PREFIX/moab.cfg
elif [ -r $MOAB_PREFIX/$ARCH/sbin/moab ]
then
startproc $MOAB_PREFIX/$ARCH/sbin/moab -C $MOAB_PREFIX/moab.cfg
fi
rc_status -v
;;
stop)
echo -n "Shutting down Moab: "
killproc moab
rc_status -v
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
status)
echo -n "Checking for moab: "
checkproc moab
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit

View File

@ -0,0 +1,46 @@
#!/bin/sh
#
# pbs This script will start and stop the PBS daemons
#
# chkconfig: 345 85 85
# description: PBS is a batch versitle batch system for SMPs and clusters
#
# Source the library functions
. /etc/rc.d/init.d/functions
# let see how we were called
case "$1" in
start)
chkconfig --list pbs_mom 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/rc.d/init.d/pbs_mom start
chkconfig --list pbs_sched 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/rc.d/init.d/pbs_sched start
chkconfig --list pbs_server 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/rc.d/init.d/pbs_server start
;;
stop)
/etc/rc.d/init.d/pbs_mom stop
/etc/rc.d/init.d/pbs_sched stop
/etc/rc.d/init.d/pbs_server stop
;;
status)
status pbs_server
status pbs_mom
status pbs_sched
;;
restart)
/etc/rc.d/init.d/pbs_mom stop
/etc/rc.d/init.d/pbs_sched stop
/etc/rc.d/init.d/pbs_server stop
chkconfig --list pbs_mom 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/rc.d/init.d/pbs_mom start
chkconfig --list pbs_sched 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/rc.d/init.d/pbs_sched start
chkconfig --list pbs_server 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/rc.d/init.d/pbs_server start
;;
*)
echo "Usage: pbs {start|stop|restart|status}"
exit 1
esac

View File

@ -0,0 +1,105 @@
#! /bin/sh
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
# Copyright (c) 2001 IBM
#
# Author: Kurt Garloff <feedback@suse.de>
# Author: Egan Ford <egan@us.ibm.com
#
# init.d/pbs
#
# and symbolic its link
#
# /usr/sbin/rcpbs
#
#
# System startup script for the nessus backend nessusd
#
### BEGIN INIT INFO
# Provides: pbs
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start pbs to allow XY and provide YZ.
### END INIT INFO
# Source SuSE config
if [ -r /etc/rc.config ]
then
. /etc/rc.config
fi
if [ -r /etc/sysconfig/xcat ]
then
. /etc/sysconfig/xcat
fi
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
# 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_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
chkconfig -list pbs_mom 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/init.d/pbs_mom start
chkconfig -list pbs_sched 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/init.d/pbs_sched start
chkconfig -list pbs_server 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/init.d/pbs_server start
;;
stop)
/etc/init.d/pbs_mom stop
/etc/init.d/pbs_sched stop
/etc/init.d/pbs_server stop
;;
restart)
/etc/init.d/pbs_mom stop
/etc/init.d/pbs_sched stop
/etc/init.d/pbs_server stop
chkconfig -list pbs_mom 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/init.d/pbs_mom start
chkconfig -list pbs_sched 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/init.d/pbs_sched start
chkconfig -list pbs_server 2>&1 | grep :on >/dev/null 2>&1
test "$?" = "0" && /etc/init.d/pbs_server start
;;
status)
checkproc pbs_server
checkproc pbs_mom
checkproc pbs_sched
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit

View File

@ -0,0 +1,55 @@
#!/bin/sh
#
# pbs_mom This script will start and stop the PBS Mom
#
# chkconfig: 345 85 85
# description: PBS is a batch versitle batch system for SMPs and clusters
#
# Source the library functions
. /etc/rc.d/init.d/functions
BASE_PBS_PREFIX=/opt/torque
ulimit -n 20000
ulimit -i 20000
chmod 777 /var/spool/pbs/spool /var/spool/pbs/undelivered
chmod o+t /var/spool/pbs/spool /var/spool/pbs/undelivered
ARCH=$(uname -m)
AARCH="/$ARCH"
if [ -d "$BASE_PBS_PREFIX$AARCH" ]
then
PBS_PREFIX=$BASE_PBS_PREFIX$AARCH
else
PBS_PREFIX=$BASE_PBS_PREFIX
fi
# let see how we were called
case "$1" in
start)
if [ -r /etc/security/access.conf.BOOT ]
then
cp -f /etc/security/access.conf.BOOT /etc/security/access.conf
fi
echo -n "Starting PBS Mom: "
daemon $PBS_PREFIX/sbin/pbs_mom -r
echo
;;
stop)
echo -n "Shutting down PBS Mom: "
killproc pbs_mom
echo
;;
status)
status pbs_mom
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: pbs_mom {start|stop|restart|status}"
exit 1
esac

View File

@ -0,0 +1,113 @@
#! /bin/sh
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
# Copyright (c) 2001 IBM
#
# Author: Kurt Garloff <feedback@suse.de>
# Author: Egan Ford <egan@us.ibm.com
#
# init.d/pbs_mom
#
# and symbolic its link
#
# /usr/sbin/rcpbs_mom
#
# System startup script for the nessus backend nessusd
#
### BEGIN INIT INFO
# Provides: pbs_mom
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start pbs_mom to allow XY and provide YZ.
### END INIT INFO
if [ -r /etc/rc.config ]
then
. /etc/rc.config
fi
if [ -r /etc/sysconfig/xcat ]
then
. /etc/sysconfig/xcat
fi
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
BASE_PBS_PREFIX=/opt/torque
ARCH=$(uname -m)
AARCH="/$ARCH"
if [ -d "$BASE_PBS_PREFIX$AARCH" ]
then
PBS_PREFIX=$BASE_PBS_PREFIX$AARCH
else
PBS_PREFIX=$BASE_PBS_PREFIX
fi
# 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_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
if [ -r /etc/security/access.conf.BOOT ]
then
cp -f /etc/security/access.conf.BOOT /etc/security/access.conf
fi
echo -n "Starting PBS Mom: "
startproc $PBS_PREFIX/sbin/pbs_mom -r
rc_status -v
;;
stop)
echo -n "Shutting down pbs_mom"
killproc pbs_mom
rc_status -v
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
status)
echo -n "Checking for pbs_mom: "
checkproc pbs_mom
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit

View File

@ -0,0 +1,46 @@
#!/bin/sh
#
# pbs_sched This script will start and stop the PBS Scheduler
#
# chkconfig: 345 85 85
# description: PBS is a batch versitle batch system for SMPs and clusters
#
# Source the library functions
. /etc/rc.d/init.d/functions
BASE_PBS_PREFIX=/opt/torque
ARCH=$(uname -m)
AARCH="/$ARCH"
if [ -d "$BASE_PBS_PREFIX$AARCH" ]
then
PBS_PREFIX=$BASE_PBS_PREFIX$AARCH
else
PBS_PREFIX=$BASE_PBS_PREFIX
fi
# let see how we were called
case "$1" in
start)
echo -n "Starting PBS Scheduler: "
daemon $PBS_PREFIX/sbin/pbs_sched
echo
;;
stop)
echo -n "Shutting down PBS Scheduler: "
killproc pbs_sched
echo
;;
status)
status pbs_sched
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: pbs_sched {start|stop|restart|status}"
exit 1
esac

View File

@ -0,0 +1,109 @@
#! /bin/sh
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
# Copyright (c) 2001 IBM
#
# Author: Kurt Garloff <feedback@suse.de>
# Author: Egan Ford <egan@us.ibm.com
#
# init.d/pbs_sched
#
# and symbolic its link
#
# /usr/sbin/rcpbs_sched
#
# System startup script for the nessus backend nessusd
#
### BEGIN INIT INFO
# Provides: pbs_sched
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start pbs_sched to allow XY and provide YZ.
### END INIT INFO
if [ -r /etc/rc.config ]
then
. /etc/rc.config
fi
if [ -r /etc/sysconfig/xcat ]
then
. /etc/sysconfig/xcat
fi
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
BASE_PBS_PREFIX=/opt/torque
ARCH=$(uname -m)
AARCH="/$ARCH"
if [ -d "$BASE_PBS_PREFIX$AARCH" ]
then
PBS_PREFIX=$BASE_PBS_PREFIX$AARCH
else
PBS_PREFIX=$BASE_PBS_PREFIX
fi
# 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_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting PBS Scheduler: "
startproc $PBS_PREFIX/sbin/pbs_sched
rc_status -v
;;
stop)
echo -n "Shutting down PBS Scheduler: "
killproc pbs_sched
rc_status -v
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
status)
echo -n "Checking for pbs_sched: "
checkproc pbs_sched
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit

View File

@ -0,0 +1,56 @@
#!/bin/sh
#
# pbs_server This script will start and stop the PBS Server
#
# chkconfig: 345 85 85
# description: PBS is a batch versitle batch system for SMPs and clusters
#
# Source the library functions
. /etc/rc.d/init.d/functions
BASE_PBS_PREFIX=/opt/torque
ARCH=$(uname -m)
AARCH="/$ARCH"
if [ -d "$BASE_PBS_PREFIX$AARCH" ]
then
PBS_PREFIX=$BASE_PBS_PREFIX$AARCH
else
PBS_PREFIX=$BASE_PBS_PREFIX
fi
PBS_HOME=/var/spool/pbs
# let see how we were called
case "$1" in
start)
echo -n "Starting PBS Server: "
if [ -r $PBS_HOME/server_priv/serverdb ]
then
daemon $PBS_PREFIX/sbin/pbs_server
else
daemon $PBS_PREFIX/sbin/pbs_server -t create
fi
echo
;;
stop)
echo -n "Shutting down PBS Server: "
# killproc pbs_server
$PBS_PREFIX/bin/qterm -t quick
RETVAL=$?
[ $RETVAL -eq 0 ] && echo_success
echo
;;
status)
status pbs_server
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: pbs_server {start|stop|restart|status}"
exit 1
esac

View File

@ -0,0 +1,116 @@
#! /bin/sh
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
# Copyright (c) 2001 IBM
#
# Author: Kurt Garloff <feedback@suse.de>
# Author: Egan Ford <egan@us.ibm.com
#
# init.d/pbs_server
#
# and symbolic its link
#
# /usr/sbin/rcpbs_server
#
# System startup script for the nessus backend nessusd
#
### BEGIN INIT INFO
# Provides: pbs_server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start pbs_server to allow XY and provide YZ.
### END INIT INFO
if [ -r /etc/rc.config ]
then
. /etc/rc.config
fi
if [ -r /etc/sysconfig/xcat ]
then
. /etc/sysconfig/xcat
fi
PBS_HOME=/var/spool/pbs
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
BASE_PBS_PREFIX=/opt/torque
ARCH=$(uname -m)
AARCH="/$ARCH"
if [ -d "$BASE_PBS_PREFIX$AARCH" ]
then
PBS_PREFIX=$BASE_PBS_PREFIX$AARCH
else
PBS_PREFIX=$BASE_PBS_PREFIX
fi
# 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_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting PBS Server: "
if [ -r $PBS_HOME/server_priv/serverdb ]
then
startproc $PBS_PREFIX/sbin/pbs_server
else
startproc $PBS_PREFIX/sbin/pbs_server -t create
fi
rc_status -v
;;
stop)
echo -n "Shutting down PBS Server: "
$PBS_PREFIX/bin/qterm -t quick
rc_status -v
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
status)
echo -n "Checking for pbs_server: "
checkproc pbs_server
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit

View File

@ -0,0 +1,16 @@
#!/usr/bin/perl
#egan@us.ibm.com
#v0.1
$/ = '';
open(STAT,"pbsnodes -a |") || die "pbsnodes error\n";
while(<STAT>) {
my $node = /^([a-zA-Z0-9\-]+)\b$/im ? $1 : '';
my $state = / + state = (.*)$/im ? $1 : '';
my $np = / + np = (.*)$/im ? $1 : '';
my $jobs = / + jobs = (.*)$/im ? $1 : '';
push @results, "$node: $state\t$jobs\n";
}
print @results;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
#!/bin/bash
#egan@us.ibm.com
#(C)IBM Corp
#
trap "exit 0" 1 2 3 15 20
sleep 5
PBS_HOME=/var/spool/pbs
PATH=$PBS_HOME/mom_priv:$PATH
TAKEDOWN=$PBS_HOME/mom_priv/takedownnode
TAKEDOWN2=$PBS_HOME/mom_priv/takedownnode2
function printline
{
for i in $(seq 1 40)
do
echo -n "-"
done
echo
}
printline
echo "Begin PBS Epilogue $(date) $(date +%s)"
echo "Job ID: $1"
echo "Username: $2"
echo "Group: $3"
echo "Job Name: $4"
echo "Session: $5"
echo "Limits: $6"
echo "Resources: $7"
echo "Queue: $8"
echo "Account: $9"
NODELIST=$(sort $PBS_HOME/aux/$1 | uniq)
(echo -n "Nodes: ";echo $NODELIST) | fold -s
NR=$(echo $NODELIST | tr ' ' ',')
echo "Killing leftovers..."
c=$(wc -l $PBS_HOME/aux/$1 | awk '{print $1}')
if ((c > 1))
then
pbspsh $NR $TAKEDOWN $2 $1 parallel 2>&1
else
pbspsh $NR $TAKEDOWN $2 $1 batch 2>&1
fi
pbspsh $(head -1 $PBS_HOME/aux/$1) $TAKEDOWN2 $2 $1 batch 2>&1
echo
echo "End PBS Epilogue $(date) $(date +%s)"
printline
exit 0

View File

@ -0,0 +1,35 @@
#!/bin/bash
#egan@us.ibm.com
#(C)IBM Corp
#
if [ "$1" = "root" ]
then
echo "$0: cannot kill root!"
exit 1
fi
if [ -z "$1" ]
then
echo "$0: kill who?"
exit 1
fi
HN=$(hostname)
for i in $(ps aux | grep "^$1 " | grep -v grep | awk '{print $2}')
do
if ps -p $i >/dev/null 2>&1
then
echo "killing $HN $i"
logger "killing $HN $i"
kill $i 2>&1
fi
if ps -p $i >/dev/null 2>&1
then
echo "KILLING $HN $i"
logger "KILLING $HN $i"
kill -9 $i 2>&1
fi
done

View File

@ -0,0 +1,91 @@
#!/bin/bash
#egan@us.ibm.com
#v2.0
#(c)IBM Corp
#PBS PSH
#
RSHC=ssh
MAXJOBS=1024
function killjobs
{
if [ ! -z "$*" ]
then
kill $* >/dev/null 2>&1
fi
exit 1
}
trap "killjobs" 1 2 3 15 20
function usage {
echo "\nUsage: pbspsh [-s] [node1,node2,node3,...] [command]\n"
}
function docommand
{
JOBS=""
nj=0
for i in $(echo $NR | tr ',' ' ')
do
c=$((c+1))
(if ping -c1 $i >/dev/null 2>&1
then
$RSHC $i "$COMMAND 2>&1" | sed "s/^/$i: /"
else
echo "$i: noping"
fi) &
if [ -z "$SERIAL" ]
then
JOBS="$JOBS $!"
if [ ! -z "$MAXJOBS" ]
then
nj=$((nj+1))
while ((nj >= $MAXJOBS))
do
for j in $JOBS
do
if ! ps -p $j >/dev/null 2>&1
then
JOBS=$(echo $JOBS | sed "s/\b$j\b//")
nj=$((nj-1))
fi
done
done
fi
else
wait $!
fi
done
wait
}
if [ "$#" = "0" ]
then
usage >&2
exit 1
fi
if [ "$1" = "-s" ]
then
SERIAL="on"
shift
else
SERIAL=""
fi
NR=$1
shift
COMMAND=$*
if [ -z "$COMMAND" ]
then
usage
exit
fi
docommand

View File

@ -0,0 +1,48 @@
#!/bin/bash
#egan@us.ibm.com
#(C)IBM Corp
#
DEBUG=""
test -n "$DEBUG" && logger pro $(date)
trap "exit 0" 1 2 3 15 20
PBS_HOME=/var/spool/pbs
PATH=$PBS_HOME/mom_priv:$PATH
SETUP=$PBS_HOME/mom_priv/setupnode
SETUP2=$PBS_HOME/mom_priv/setupnode2
function printline
{
for i in $(seq 1 40)
do
echo -n "-"
done
echo
}
printline
echo "Begin PBS Prologue $(date) $(date +%s)"
echo "Job ID: $1"
echo "Username: $2"
echo "Group: $3"
NODELIST=$(sort $PBS_HOME/aux/$1 | uniq)
(echo -n "Nodes: ";echo $NODELIST) | fold -s
NR=$(echo $NODELIST | tr ' ' ',')
test -n "$DEBUG" && logger pro $(date)
pbspsh $NR $SETUP $2 $3 $1 2>&1 | logger
pbspsh $(head -1 $PBS_HOME/aux/$1) $SETUP2 $2 $3 $1 2>&1 | logger
test -n "$DEBUG" && logger pro $(date)
echo "End PBS Prologue $(date) $(date +%s)"
printline
#sleep 5
exit 0

View File

@ -0,0 +1,40 @@
#!/bin/bash
#egan@us.ibm.com
#(C)IBM Corp
#
USER=$1
GROUP=$2
PBS_JOBID=$3
export LANG=C
if [ -n "$USER" ]
then
rm -f /tmp/pvm[dl].$(id -u $USER) 2>&1
fi
if [ -n "$PBS_JOBID" -a -n "$USER" -a -n "$GROUP" ]
then
for i in /scr /nobackup /tmp
do
if [ -d $i ]
then
if [ -d $i/$PBS_JOBID ]
then
rm -rf $i/$PBS_JOBID 2>&1
fi
mkdir -p $i/$PBS_JOBID 2>&1
chown $USER.$GROUP $i/$PBS_JOBID 2>&1
chmod 700 $i/$PBS_JOBID
fi
done
fi
if [ -n "$USER" ]
then
if [ "$USER" != "root" ]
then
perl -pi -e "s/:ALL$/ $USER:ALL/" /etc/security/access.conf
fi
fi

View File

@ -0,0 +1,26 @@
#!/bin/bash
#egan@us.ibm.com
#(C)IBM Corp
#
USER=$1
GROUP=$2
PBS_JOBID=$3
if [ -n "$PBS_JOBID" -a -n "$USER" -a -n "$GROUP" ]
then
for i in /gpfs* /scratch /net/scratch*
do
if [ -d $i ]
then
if [ -d $i/$PBS_JOBID ]
then
rm -rf $i/$PBS_JOBID 2>&1
fi
mkdir -p $i/$PBS_JOBID 2>&1
chown $USER.$GROUP $i/$PBS_JOBID 2>&1
chmod 700 $i/$PBS_JOBID
fi
done
fi

View File

@ -0,0 +1,91 @@
#!/bin/bash
#egan@us.ibm.com
#(C)IBM Corp
#
PBS_HOME=/var/spool/pbs
PATH=$PBS_HOME/mom_priv:$PATH
export LANG=C
function showkids
{
pstree -cp $1 | \
perl -pi -e 's/(\(|,)/\n/g' | \
egrep '^[0-9]+\)' | \
awk -F\) '{print $1}' | \
grep -v $1
}
function killkids
{
for j in $(showkids $1)
do
if ps -p $j >/dev/null 2>&1
then
echo "$2 killing child PID $j PPID $1 PBS_JOBID $3"
logger "$2 killing child PID $j PPID $1 PBS_JOBID $3"
kill $j 2>&1
fi
if ps -p $j >/dev/null 2>&1
then
echo "$2 KILLING child PID $j PPID $1 PBS_JOBID $3"
logger "$2 KILLING child PID $j PPID $1 PBS_JOBID $3"
kill -9 $j 2>&1
fi
done
}
USER=$1
PBS_JOBID=$2
TYPE=$3
HN=$(hostname | awk -F. '{print $1}')
if [ "$TYPE" = "batch" ]
then
if [ "$USER" != "root" ]
then
perl -pi -e "s/ $USER\b//" /etc/security/access.conf
fi
cd /proc
for i in $(
egrep -l "\bPBS_JOBID=$PBS_JOBID\b" [1-9]*/environ 2>/dev/null | \
awk -F/ '{print $1}'
)
do
killkids $i $HN $PBS_JOBID
logger "killkids $i $HN $PBS_JOBID"
if ps -p $i >/dev/null 2>&1
then
echo "$HN killing PID $i PBS_JOBID $PBS_JOBID"
logger "$HN killing PID $i PBS_JOBID $PBS_JOBID"
kill $i 2>&1
fi
if ps -p $i >/dev/null 2>&1
then
echo "$HN KILLING PID $i PBS_JOBID $PBS_JOBID"
logger "$HN KILLING PID $i PBS_JOBID $PBS_JOBID"
kill -9 $i 2>&1
fi
done
fi
if [ "$TYPE" = "parallel" ]
then
if [ "$USER" != "root" ]
then
perl -pi -e "s/ $USER\b//g" /etc/security/access.conf
killuser $USER
fi
fi
for i in /scr /nobackup /tmp
do
if [ -d $i/$PBS_JOBID ]
then
rm -rf $i/$PBS_JOBID 2>&1
fi
done
#rm -f /tmp/pvm[dl].$(id -u $USER) 2>&1

View File

@ -0,0 +1,18 @@
#!/bin/bash
#egan@us.ibm.com
#(C)IBM Corp
#
USER=$1
PBS_JOBID=$2
TYPE=$3
HN=$(hostname | awk -F. '{print $1}')
for i in /gpfs* /scratch /net/scratch*
do
if [ -d $i/$PBS_JOBID ]
then
rm -rf $i/$PBS_JOBID 2>&1
fi
done

View File

@ -0,0 +1,57 @@
#!/bin/bash
#egan@us.ibm.com
#(C)IBM Corp
MYNAME=$(basename $0)
function usage {
echo
echo "Usage: ${MYNAME} [noderange] [offline|clear|online|stat|state]"
echo
}
if [ "$#" != "2" ]
then
usage >&2
exit 1
fi
which pbsnodes >/dev/null 2>&1
if [ "$?" = "1" ]
then
echo "\n${MYNAME}: pbsnodes not in path\n"
exit 1
fi
case "$2" in
"offline"|"off")
for i in $(nodels $1)
do
pbsnodes $i -o
echo "$i: offline"
done
;;
"clear"|"online"|"on")
for i in $(nodels $1)
do
pbsnodes $i -c
echo "$i: online"
done
;;
"stat"|"state")
EGREP="($(for i in $(nodels $1)
do
echo -n "$i|"
done | sed 's/.$//'))"
if [ "$EGREP" != "()" ]
then
pbsnodestat | egrep "^${EGREP}:"
fi
;;
*)
echo "\n${MYNAME}: Last arg must be offline|clear|stat\n" >&2
usage >&2
exit 1
;;
esac