#odtug, ACE, ACEA, concurrent program, E-Business Suite, EBS, EBS 11i, Hints and Tip, Hints and Tips, hobby, Implementation, LINUX, Oracle, request set, Shell Script, support, technology, UNIX

Using Shell Scripts as Concurrent Programs in EBS

Using Shell Scripts as Concurrent Programs in EBS

Recently, I started looking at way to address a scheduling problem when moving files associated with our business partners. We currently have a three step process:

  1. Schedule a Concurrent Program to produce a file
  2. Set up a cronjob to schedule a shell script to move and archive that file on a SAMBA server for our Business Units to access (we are a Windows shop)
  3. Using Windows Scheduler, launch a C# program that will move the file from the SAMBA server to an FTP site where the business partner can “pick up” the file.
Using Shell Scripts as Concurrent Programs in EBS
To receive files from our Business Partners, we simply reverse the process.  As you can imagine, this can be a scheduling nightmare.  If any of these activities gets out of sync, the entire process fails, and technical resources need to manually move the files.In an effort to address this situation, we are going to rewrite the shell scripts to perform all the file movement activities and register it as a part of a concurrent request set. This will eliminate the scheduling issue, by only running the shell script once the file has been generated.  An added benefit is completion time for the process.  Now that the two processes are tied together (via request set), there is not gap or dead time between the tasks.Let’s get to it:First I’m going to create a few shell scripts — in this case, the values needed to FTP a fileFILE #1
#!/bin/ksh 
# File name: ftp_setup.sh
# Description: Define values for remote ftp server
################################ REMOTE FTP ###########################
export blog_host=’ftp01.blog.com’
export blog_user=’blog12345′
export blog_pwd=’DE45rtY7′
export blog_ftp_target=’upload’
export blog_file=’filename’
export blog_email=’addy1@emailaddy.com
########################################################################FILE #2
#!/bin/sh
# File name: ftp_interface.sh (extension changed to prog for EBS concurrent program)
# Description: Define values for remote ftp server
################################ EXECUTION SCRIPT######################
. /home/dbryant/Documents/ftp_setup.sh
echo “loading values”
if [ $5== “Yes” ]; then  #parameter passed in from Concurrent Program
/home/dbryant/Documents/do_ftp.sh $blog_host $blog_user $blog_pwd $blog_ftp_target $blog_file $blog_email
elif [ $5 == “No” ]; then
echo “No FTP!”
else 
echo “Invalid option please enter (Yes or No)”
fi
echo “End”


FILE #3
#!/bin/ksh
#—————————————————
# Script Name: DO_FTP.prog
# Script Purpose: FTP file to business
# Script Dependencies: file exists
#—————————————————

#FTP script
ftp -n $1 <<end_script end_script=”” i=””>
quote USER $2
quote PASS $3
cd $4
put $5
quit
END_SCRIPT

echo “The file transfer was successful” | mailx -s “FTP File Transfer Notification” $6

exit 0

Once I have my scripts written and tested, I need to put them in the $XBOL_TOP/bin directory.  While only the one file you are going to execute as part of the request set needs to be in this directory, it just makes it easier.

1. You will need to change the file extension of the script you are registering to .prog.  In this case FILE #2: ftp_interface.sh will be ftp_interface.prog. 

2. Next, change the permissions on the file to 755.

Using Shell Scripts as Concurrent Programs in EBS

3. Create a symbolic link to the script.

Using Shell Scripts as Concurrent Programs in EBS

4. You can now register your program as am executable in EBS with HOST as the Execution Method.
Using Shell Scripts as Concurrent Programs in EBS

You can now register this as a Concurrent Program and/or include it in a Request Set. There are plenty of blog post and documentation for that, so have at it.

Something to note: If you decide to pass a parameter to you shell script, you will need to start with $5.  The first four are reserved for the USERID, REQUEST,_ID, RESP_ID, RESP_APPL_ID.

Using Shell Scripts as Concurrent Programs in EBS

Have Fun!!