有时候在服务器上批量管理作业的时候需要知道作业的JOBNO用于清理日志,或者备份作业的时候需要知道作业的具体目录,这时候通过designer或者director来查看作业信息,工作量将会非常巨大,分享一个查找作业NO及目录的脚本
# Script Name - DSgetJobNo.sh
# Developer - Atul Singh
# Description - This script query on the Datastage UV DB
# and get the internal job no and catagory assigned to job
# Date - Feb 25, 2014
# Plateform - AIX,LINUX, UNIX, Solarix and all NIX
#!/bin/ksh
##!/bin/sh
. /opt/IBM/InformationServer/Server/DSEngine/dsenv > /dev/null 2>&1
DSProject="$1"
DSJob="$2"
if [[ -z "$DSProject" || -z "$DSJob" ]]; then
echo "\nUsage: $0 <DSProject> <DSJob>\n"
exit 1
fi
echo "Job Info for job(s): \"$DSJob\" in project: \"$DSProject\"..."
export DSHOME=`cat /.dshome`
cd $DSHOME
./bin/uvsh << EOF 2> /dev/null
LOGTO $DSProject
SELECT @ID FMT '80L', CATEGORY FMT '80L', JOBNO FROM DS_JOBS WHERE NAME LIKE '%$DSJob%' OR JOBNO = '$DSJob' ORDER BY NAME;
EOF