![]() |
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 |
| bdf script not working !! | kpatel786 | Shell Programming and Scripting | 3 | 11-16-2007 11:10 AM |
| Pls. Help my script not working as it should | cocoabeauty1 | Shell Programming and Scripting | 1 | 07-28-2007 05:11 PM |
| FTP script not working | rookie250 | Shell Programming and Scripting | 2 | 12-19-2006 02:49 AM |
| Script not working as desired | mhssatya | Shell Programming and Scripting | 39 | 08-23-2006 09:51 AM |
| Backspace Not Working in Script | Atama | Shell Programming and Scripting | 4 | 04-26-2002 10:17 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
that's because you did not create the new file first before mv'ing to destination.
|
|
||||
|
My actual Script is :
My actual Script is :
#!/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: gasbuster_incentive_extract.ksh <staging/qa/production>" exit 1 fi cd $LOGPATH rm rep_commitment_load* OUTPUTLOGFILE=$LOGPATH/rep_commitment_load.log;export OUTPUTLOGFILE; cd /sharedapps/etlusr/etl/ftp/ temp=`ls ORD*` for prevfile in $temp; do prevfile=$prevfile.`date +%D%H%M%S` mv $prevfile $OLDDATAPATH done #$prevfile=`find /sharedapps/etlusr/etl/ftp/ORD*` echo $prevfile >>$OUTPUTLOGFILE #mv `find /sharedapps/etlusr/etl/ftp/ORD*` $OLDDATAPATH/`find /sharedapps/etlusr/etl/ftp/ORD*`.`date +%D%H%M%S` #echo "open $SERVERNAME">$LOGPATH/rep_commitment_load echo "user $FTPLOGIN $FTPPASSWD">>$LOGPATH/rep_commitment_load echo "quote site blocksize=8000 lrecl=80 recfm=fb">>$LOGPATH/rep_commitment_load echo "cd ..">>$LOGPATH/rep_commitment_load echo "lcd $LOGPATH">>$LOGPATH/rep_commitment_load sqlplus -s $ORAUSER <<EOF >OUTPUTLOGFILE @$SCRIPTDIR/rep_commitment_load.sql EOF 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" 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 $DATEFILEPATH >> $OUTPUTLOGFILE echo " ================================================================ Rep Commitment Load process failed with ORA errors. Please check log file - $OUTPUTLOGFILE =================================================================" exit 1 fi exit 0 fi exit; ############################################################################## I am able to call the sql file., but the files not getting moved to OLDDATAPATH ., from the for loop., Please look after and help me out. Raja |
|
||||
|
So what do you get if you run a pared-down version like this one?
Code:
#!/bin/ksh cd /sharedapps/etlusr/etl/ftp/ pwd # for debugging temp=`ls ORD*` for prevfile in $temp; do echo "# file: $prevfile" # for debugging prevfile=$prevfile.`date +%D%H%M%S` echo mv $prevfile $OLDDATAPATH # note echo for debugging done Last edited by era; 03-27-2008 at 02:21 PM.. Reason: Add cd to right directory |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|