#!/bin/ksh # Author: Brendan Furey, 28 September 2014 # Description: A generic concurrent program uploader script, as described here: # 'A Generic Unix Script for Uploading Oracle eBusiness Concurrent Programs' # http://aprogrammerwrites.eu/?p=1282 # mv_files() { cp *ldt ../../import cp *xml ../../import cp *xsl ../../import cp *rtf ../../import cp *sql ../../install/sql cp *pks ../../install/sql cp *pkb ../../install/sql } process_params() { # # Assign input parameters and system values to variables # pw=$1 cp_name=$2 app=$3 jdbc=$4 admin_dir=../../import sysdate=`date "+%Y/%m/%d"` rg_down_ldt=rg_down.ldt rg_up_ldt=rg_up.ldt rg_lis=${cp_name}_RG.lis echo $0 $sysdate } check_file() { if [ ! -s "$1" ] ; then echo The $2 configuration file $1 does not exist ! exit 1 fi } make_rg_file() { echo FNDLOAD apps/pw 0 Y DOWNLOAD $lct_file $rg_down_ldt REQUEST_GROUP REQUEST_GROUP_NAME="$1" APPLICATION_SHORT_NAME=$2 FNDLOAD apps/$pw 0 Y DOWNLOAD $lct_rg $rg_down_ldt REQUEST_GROUP REQUEST_GROUP_NAME="$1" APPLICATION_SHORT_NAME=$2 rgu_line1=36 (head -$rgu_line1 $rg_down_ldt ; echo ' BEGIN REQUEST_GROUP_UNIT "P" "APPNAME" "REPNAME" OWNER = "ORACLE" LAST_UPDATE_DATE = "ph_sysdate" END REQUEST_GROUP_UNIT END REQUEST_GROUP ') | sed "s:ph_sysdate:$sysdate:" | sed 's/REPNAME/'$3'/' | sed 's/APPNAME/'$4'/' > $rg_up_ldt echo Processing Request Group assignments for group "$1" echo FNDLOAD apps/pw 0 Y UPLOAD $lct_rg $rg_up_ldt FNDLOAD apps/$pw 0 Y UPLOAD $lct_rg $rg_up_ldt } validate() { # # ldt files... # ldt_prog=$admin_dir/${cp_name}_CP.ldt ldt_dd=$admin_dir/${cp_name}_DD.ldt ldt_vs=$admin_dir/${cp_name}_VS.ldt # optional so do not check existence here ldt_ms=$admin_dir/${cp_name}_MS.ldt # optional so do not check existence here ldt_ag=$admin_dir/${cp_name}_AG.ldt # optional so do not check existence here check_file $ldt_prog "Program" check_file $ldt_dd "Data Definition" ldt_temp=${cp_name}_TP.ldt # # lct files... # lct_prog=$FND_TOP/patch/115/import/afcpprog.lct lct_rg=$FND_TOP/patch/115/import/afcpreqg.lct lct_dd=$XDO_TOP/patch/115/import/xdotmpl.lct lct_vs=$FND_TOP/patch/115/import/afffload.lct lct_ms=$FND_TOP/patch/115/import/afmdmsg.lct lct_ag=$FND_TOP/patch/115/import/affaudit.lct check_file $lct_rg "Request Group" check_file $lct_prog "Program" check_file $lct_dd "Data Definition" check_file $lct_vs "Value Set" check_file $lct_ms "Message" check_file $lct_ag "Audit Group" # # Template files... # xml_file=$admin_dir/${cp_name}.xml bur_file=$admin_dir/${cp_name}_BUR.xml # optional so do not check existence here check_file $xml_file "XML" # # Check the apps password # ret=`sqlplus -s apps/$pw < $ldt_temp echo Uploading the Audit Groups from file $ldt_temp... FNDLOAD apps/$pw 0 Y UPLOAD $lct_ag $ldt_temp CUSTOM_MODE=FORCE - # # Report results from database # sqlplus -s apps/$pw < $ldt_temp echo Uploading the Messages from file $ldt_temp... FNDLOAD apps/$pw 0 Y UPLOAD $lct_ms $ldt_temp CUSTOM_MODE=FORCE - # # Report results from database # sqlplus -s apps/$pw < $ldt_temp chmod +w $ldt_temp echo Uploading Value Set from file $ldt_temp... FNDLOAD apps/$pw 0 Y UPLOAD $lct_vs $ldt_temp CUSTOM_MODE=FORCE - # # Report results from database # sqlplus -s apps/$pw < $ldt_temp chmod +w $ldt_temp echo Processing Load file $ldt_temp... echo FNDLOAD apps/$pw 0 Y UPLOAD $lct_prog $ldt_temp - FNDLOAD apps/$pw 0 Y UPLOAD $lct_prog $ldt_temp CUSTOM_MODE=FORCE - # # Report results from database # sqlplus -s apps/$pw < $ldt_temp echo Uploading the Data Definition "$2" from file $ldt_temp... FNDLOAD apps/$pw 0 Y UPLOAD $lct_dd $ldt_temp CUSTOM_MODE=FORCE - # # Report results from database # sqlplus -s apps/$pw <$2.log exec 2>$2.err process_params $1 $2 $3 $4 # # Untar the source file and move the files to the main application installation directories # tar -xvf ${cp_name}.tar cd ${cp_name} mv_files # # Validate the files and parameters passed, then upload the apps metadata, templates, package # validate upload_ag upload_ms upload_vs upload_cp upload_rga upload_dd upload_all_temps install_pkg # # Installation done, now write the standard logs into the main log # echo "The Oracle Loader logs (in directory $2) contain..." #for file in `grep Log ../$2.err|cut -d" " -f4`; do for file in `ls -1 L*.log`; do echo "***" echo $file echo "***" cat $file done