6.20.2014

Script to kill running jobs

#!/usr/bin/ksh
#SCRIPT:   kill_jobs.ksh
#AUTHOR:   Michael T. Bee
#DATE:     20-Jun-2014
#REV:      1.1.A(ValidareA,B,D,TandP)
#          (ForAlpha,Beta,Dev,TestandProduction)
#PLATFORM: Solaris
#PURPOSE:  This kills all running jobs
#REVLIST:
#          DATE:
#          BY:
#          MODIFICATION:
################################################################################
#set -n    #Uncomment to check script syntax,without execution.
#          #NOTE:Do not forget to put the comment back in or
#          #     the shell script will not execute!
set +x    #Uncomment to make this script 'live'
#set -x    #Uncomment to debug this shell script
#-
#Note:     Comment out the execution of 'cleanup' below in order to leave
#          data files for review or debug.
#          Remember to uncomment once you're satisfied with the process.
################################################################################
# VARIABLES
################################################################################
# ${jobs}                            : job numbers to be killed
################################################################################
# FILES
################################################################################
jobs=`jobs|cut -f1 -d"]"|cut -f2 -d"["`
for i in { $jobs }
do
        if [[ "\{" != "\$i" && "\}" != "\$i" ]];then
                kill %$i
        fi
done