The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SAP swap recommendations jhtrice UNIX for Advanced & Expert Users 2 12-21-2008 10:28 AM
XTP recommendations overlap with CEP… iBot Complex Event Processing RSS News 0 06-13-2008 08:50 PM
your recommendations antalexi Shell Programming and Scripting 1 08-30-2005 04:23 PM
Recommendations for a convert Keith UNIX for Dummies Questions & Answers 2 02-06-2001 03:18 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-26-2009
Ariean Ariean is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 25
Request for Recommendations

Hello Guru's,

I created this shell script to copy over the files from one location to other location and generating a list of files to process them through ETL tool. Could you please review the code and tell me if you have any recommendations or changes for my code or any thing wrong in my code. Appreciate your time and help, Thank you!

Code:
#!/bin/sh
#set -x
uploaddir="/u01/app/informatica/dev3/sample/GPMDir/UploadDir"
processdir="/u01/app/informatica/dev3/sample/GPMDir/ProcessDir"
datetime=`date +%Y%m%d`
logdir="$processdir/GPMLogFile_$datetime.log"

echo "<---------------Start Copying & Moving GPM Files To Process Directory-------------->" > $logdir

cat /dev/null >$processdir/dummy.txt
echo "Creating A Dummy File In The Process Directory" >> $logdir

rm -rf $processdir/*.list
echo "Removed All The List Files Generated Earlier In The Process Directory" >> $logdir

cd $uploaddir
echo "Current Directory Path Is:" >> $logdir
echo "`pwd`" >> $logdir

if [ -f "$uploaddir"/"GPM_"*".csv" ];then
	cp $uploaddir/GPM_*.csv $processdir
          if [ $? -eq 0 ] ; then
          echo "Master GPM Files Were Copied Successfully Into Process Directory" >> $logdir
          else
	  echo "Error In Copying Master GPM Files Into Process Directory" >> $logdir
          fi
else 
	echo  "Master GPM Files Doesn't Exists In Upload Directory, Hence Cann't Copy Over The Files Into The Process Directory" >> $logdir
fi

if [ -f "$uploaddir"/*"_FI.csv" ]; then
		for i in `ls -rt *_FI.csv`
		do
			echo $processdir/$i>> $processdir/GPM_FI.list
			cp $uploaddir/$i $processdir
			#mv $uploaddir/$i $processdir
		done
	echo "FI Files Exists, Generated The FI File List & Copied Over The FI Files Successfully Into The Process Directory" >> $logdir
else 
	echo "FI Files Doesn't Exists,Creating Dummy File List" >> $logdir
	ls -rt $processdir/dummy.txt > $processdir/GPM_FI.list
fi
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0