![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to generate html file using script? | kittusri9 | Shell Programming and Scripting | 2 | 05-25-2008 11:38 PM |
| Script to generate text file from excel file | isingh786 | UNIX for Dummies Questions & Answers | 1 | 01-24-2008 10:32 AM |
| generate xml from a shell script | speedieB | UNIX for Dummies Questions & Answers | 1 | 07-27-2006 08:38 AM |
| Modify script to generate a log file | heprox | Shell Programming and Scripting | 2 | 06-14-2006 10:40 AM |
| ksh Script to Generate Symbolic Links | dwisconbug | Shell Programming and Scripting | 1 | 05-08-2006 07:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
To generate the FTP Script file
Hi,
I am new to the shell programming., My requirement is , I have an shell file, which call internally the sql file, which generates 4 files on the directory., and then shell has to create the file which contains all the ftp commands to extract the files to different server for later processing. Please have a look at the below script and please help me out in regards., #!/bin/ksh ################################################################################ INPARM=$1 . /sharedapps/etlusr/etlusrenv/etlusrenv repcommitments #To remove the old log files if [ "$INPARM" = staging ]; then FTPLOGIN=$STGFTPLOGIN FTPPASSWD=$STGFTPPASSWD SERVERNAME=$STGSERVERNAME FILEPREFIX=ORDPT. ORAUSER=ecometlusr/ecometlusr_dev@ecomd elif [ "$INPARM" = qa ]; then FTPLOGIN=$QAFTPLOGIN FTPPASSWD=$QAFTPPASSWD SERVERNAME=$QASERVERNAME FILEPREFIX=ORDPT. elif [ "$INPARM" = production ]; then FTPLOGIN=$PRODFTPLOGIN FTPPASSWD=$PRODFTPPASSWD SERVERNAME=$PRODSERVERNAME FILEPREFIX=ORDPP. else echo "NOTE: $INPARM is not a valid running environment" echo "Usage: rep_commitment_load.ksh <staging/qa/production>" exit 1 fi echo running line1 cd $LOGPATH rm rep_commitment_load* OUTPUTLOGFILE=$LOGPATH/rep_commitment_load.log;export OUTPUTLOGFILE; FILEPATH="/sharedapps/etlusr/etl/ftp" OLDDATAPATH="/sharedapps/etlusr/commitments/olddata" OUTPUTLOGFILE=$LOGPATH/rep_commitment_load_ftp.log;export OUTPUTLOGFILE; echo "OUTPUTLOGFILE $OUTPUTLOGFILE" >>$OUTPUTLOGFILE cd $FILEPATH temp=`ls ORD*` for prevfile in $temp; do mv $prevfile $OLDDATAPATH/$prevfile.`date +%d%h%m%s` done echo $prevfile >>$OUTPUTLOGFILE echo "open $SERVERNAME">$LOGPATH/rep_commitment_load_ftp echo "user $FTPLOGIN $FTPPASSWD">>$LOGPATH/rep_commitment_load_ftp echo "quote site blocksize=8000 lrecl=80 recfm=fb">>$LOGPATH/rep_commitment_load_ftp #echo "cd ..">>$LOGPATH/rep_commitment_load_ftp echo "lcd $FILEPATH">>$LOGPATH/rep_commitment_load_ftp sqlplus -s $ORAUSER <<EOF >OUTPUTLOGFILE @$SCRIPTDIR/rep_commitment_load.sql EOF echo cd $FILEPATH echo "mput ORD* >>$LOGPATH/rep_commitment_load_ftp echo "close">>$LOGPATH/rep_commitment_load_ftp echo "quit">>$LOGPATH/rep_commitment_load_ftp echo "Done FTP commands" cd $LOGPATH ORAERRCNT=`cat rep_commitment_load* | grep "ORA-"|wc -l` ONECNT=1 if [ $ORAERRCNT -lt $ONECNT ]; then ftp -ivn < $LOGPATH/rep_commitment_load_ftp >$LOGPATH/rep_commitment_load_ftp.log ================================================================ Rep Commitment Load process successfull. Please check log file - $OUTPUTLOGFILE =================================================================" exit 0 else cat $FILEPATH >> $OUTPUTLOGFILE echo " ================================================================ Rep Commitment Load process failed with ORA errors. Please check log file - $OUTPUTLOGFILE =================================================================" exit 1 fi exit 0 fi exit; Raja |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|