Problem with embedded FTP command in Ksh - System Cannot find the specified path.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with embedded FTP command in Ksh - System Cannot find the specified path.
# 1  
Old 11-19-2009
Problem with embedded FTP command in Ksh - System Cannot find the specified path.

I have the following FTP embedded in a Ksh script on AIX 5.3

Code:
 
ftp -n <<WHATEVER
 open 10.101.26.218
 user hcistats *******
 ascii
 put $thupdatefile 
 put $thcollectfile
 quit
WHATEVER

Here is what my script returns:
Code:
 
/qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thupdate.20091118.csv: The system cannot find the path specified.
/qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thcollect.20091118.csv: The system cannot find the path specified.

However the files exists:
Code:
 
/>ls -al /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thupdate.20091118.csv
-rw-rw-r--   1 hci      staff          7103 Nov 19 15:26 /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thupdate.20091118.csv

/>ls -al /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thcollect.20091118.csv
-rw-rw-r--   1 hci      staff          9241 Nov 19 15:26 /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thcollect.20091118.csv

I can even view the contents of the file, so permissions should be fine.
Code:
 
/>head /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thupdate.20091118.csv
TH,20091119,TOdfm,,1A58Tdfm,msjst1,hsdvim2b,TO,dfm,pdl-tcpip,frl,,Client,10.40.96.17,9600,805,468,,,,
TH,20091119,TRdfm,,1A58Tdfm,msjst1,hsdvim2b,TR,dfm,pdl-tcpip,HL7 2.2,,Server,,7128,806,398,,,,
TH,20091119,TRmisysl,,1A16Tmisysl,msjst1,hsdvim2b,TR,misysl,pdl-tcpip,HL7 2.2,,Server,,7145,1069,397,,,,
TH,20091119,TOmisysl,,1A16Tmisysl,msjst1,hsdvim2b,TO,misysl,pdl-tcpip,frl,,Client,10.43.95.244,5005,1069,468,,,,
TH,20091119,TRpyxis,,1A4Tpyxis,msjst1,hsdvim2b,TR,pyxis,pdl-tcpip,HL7 2.2,,Server,,7152,1203,397,,,,
TH,20091119,TOpyxis,,1A4Tpyxis,msjst1,hsdvim2b,TO,pyxis,pdl-tcpip,frl,,Client,10.140.18.12,1001,1203,468,,,,
TH,20091119,TOpwrscb,,1A57Tpwrscb,msjst1,hsdvim2b,TO,pwrscb,pdl-tcpip,frl,,Client,10.4.49.20,18010,671,468,,,,
TH,20091119,TRpwrscb,,1A57Tpwrscb,msjst1,hsdvim2b,TR,pwrscb,pdl-tcpip,HL7 2.2,,Server,,7125,671,398,,,,
TH,20091119,TOephny,,1A19Tephny,msjst1,hsdvim2b,TO,ephny,pdl-tcpip,frl,,Client,10.40.95.23,7518,1470,468,,,,
TH,20091119,TRephny,,1A19Tephny,msjst1,hsdvim2b,TR,ephny,pdl-tcpip,HL7 2.2,,Server,,7169,1470,397,,,,

/>head /qdxtest/qdx5.4/integrator/archiveqdx/hcistats.thcollect.20091118.csv
TH,20091118,20091119152435,TOdfm,1A58Tdfm,msjst1,hsdvim2b,up,up,20091113123131,19000101000000,20091119145338,20091119145338,10,6190,0,0
TH,20091118,20091119152437,TRdfm,1A58Tdfm,msjst1,hsdvim2b,up,up,20091113123159,19000101000000,20091119145338,19000101000000,42,47160,0,0
TH,20091118,20091119152439,TRmisysl,1A16Tmisysl,msjst1,hsdvim2b,up,up,20091113123204,19000101000000,20091119145338,19000101000000,43,48515,0,0
TH,20091118,20091119152441,TOmisysl,1A16Tmisysl,msjst1,hsdvim2b,up,up,20091113123240,19000101000000,20091119145338,20091119145338,43,22508,0,0
TH,20091118,20091119152443,TRpyxis,1A4Tpyxis,msjst1,hsdvim2b,up,up,20091113123233,19000101000000,20091119145338,19000101000000,23,32035,0,0
TH,20091118,20091119152445,TOpyxis,1A4Tpyxis,msjst1,hsdvim2b,up,up,20091113123315,19000101000000,20091119145338,20091119145338,22,12493,0,0
TH,20091118,20091119152447,TOpwrscb,1A57Tpwrscb,msjst1,hsdvim2b,up,up,20091113123305,19000101000000,20091119145338,20091119145338,11,2957,0,0
TH,20091118,20091119152449,TRpwrscb,1A57Tpwrscb,msjst1,hsdvim2b,up,up,20091113123432,19000101000000,20091119145338,19000101000000,11,21359,0,0
TH,20091118,20091119152451,TOephny,1A19Tephny,msjst1,hsdvim2b,up,up,20091113123359,19000101000000,20091116154327,20091116154325,0,0,0,0
TH,20091118,20091119152453,TRephny,1A19Tephny,msjst1,hsdvim2b,up,up,20091113123444,19000101000000,20091119001046,19000101000000,1,771,0,0

Anyone have ideas why the FTP command can't find my files? Suggestions on how this could be done differently?

Thanks!
Troy
# 2  
Old 11-19-2009
Is this a cron file entry? It looks as if the environment is not set correctly.
# 3  
Old 11-20-2009
Its not a cron entry. I'm running the script from the command line. The same script creates the files and executes the FTP.

Code:
#!/usr/bin/ksh


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


function hcistats_main {

# Setup the logfile and error file
logfile="$HCIROOT/archiveqdx/hcistats.$today.log"
errfile="$HCIROOT/archiveqdx/hcistats.$today.err.log"

# Initialize total messages processed on this server
hosttotal=0

# If a date is supplied, collect stats for that date
if [[ -n $1 ]]
then
	collectdate=$1
fi

# setup daily stat collection files
thcollectfile="$HCIROOT/archiveqdx/hcistats.thcollect.$collectdate.csv"
prcollectfile="$HCIROOT/archiveqdx/hcistats.prcollect.$collectdate.csv"
stcollectfile="$HCIROOT/archiveqdx/hcistats.stcollect.$collectdate.csv"
svcollectfile="$HCIROOT/archiveqdx/hcistats.svcollect.$collectdate.csv"

# setup daily info update files
thupdatefile="$HCIROOT/archiveqdx/hcistats.thupdate.$collectdate.csv"
prupdatefile="$HCIROOT/archiveqdx/hcistats.prupdate.$collectdate.csv"
stupdatefile="$HCIROOT/archiveqdx/hcistats.stupdate.$collectdate.csv"
svupdatefile="$HCIROOT/archiveqdx/hcistats.svupdate.$collectdate.csv"

echo "\n------------------------- hcistats initiated $today -------------------------" >> $errfile

rm $thcollectfile $prcollectfile $stcollectfile $svcollectfile $thupdatefile >> $logfile 2>> $errfile

# If a site argument is supplied just run for that site.
if [[ -n $2 ]]
then
	mysites=$2
else
  # get a list of sites
  mysites=`cat $HCIROOT/prodsites`
fi

echo "--------------------------- Run date: $today -------------------------"       >> $logfile
echo "------------------------- Stats Date: $collectdate -------------------------" >> $logfile

# Get name of server I'm running on
myhost=`hostname`
echo "----------------------------- Server: $myhost -------------------------" >> $logfile

echo "User specified sites:\n$mysites"                                              >> $logfile

for mysite in $mysites
do
  
  # Setup Cloverleaf environment variables and hci commands
  setroot
  setsite $mysite
  
  # Verify the setsite command was successful
  sitecheck=`showroot | grep "HCI site" | awk '{print $4}'`
  if [[ $sitecheck == $mysite ]]
  then
  
    # If the site directory exists in archives, get stats
    mysitedir=$HCIROOT/archiveqdx/$mysite
    if [[ -d $mysitedir ]]
    then
    	
    	 echo "\n------------------------- Site: $mysite -------------------------" >> $logfile
       sitetotal=`hcistats_site $myhost $mysite`
       hosttotal=$(( $hosttotal + $sitetotal ))
       
    else
    
       echo "ERROR - Archive directory \"$mysitedir\" not found.  Skipping site $mysite." >> $errfile
       
    fi
    
  else 
  
  	 echo "ERROR - Setsite Command failed for $mysite.  Skipping site $mysite." >> $errfile
    
  fi

done

echo "Total messages for server $myhost: $hosttotal" >> $logfile
echo "--------------------------------------------------------------------------------" >> $logfile

ftp -n <<WHATEVER
 open 10.101.26.218
 user hcistats *******
 ascii
 put $thupdatefile 
 put $thcollectfile
 quit
WHATEVER

}


Last edited by troym72; 11-20-2009 at 10:41 AM..
# 4  
Old 11-23-2009
The failure is probably because the full path does not exist on the remote ftp server.
If you just want to place the file in the home directory of the remote ftp server consider doing a shell "cd" before the ftp and use the filename without the directory name in the "put" statement.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

How to find the path of a command?

Hi guys. I want to know the path of a command. I tried "which" command also . But no luck. Please tell me how to find and update the correct path of the command. Here I'm unable to find the path of ext2online command # resize2fs /dev/vg01/lvora_backup resize2fs 1.39 (29-May-2006)... (3 Replies)
Discussion started by: vamshigvk475
3 Replies

2. Solaris

Find path of executable having problem

Hi cannot find the path to a running process on a host. I looked and tried some suggestions in forums to no avail. can someone please help? I need to know where this process is starting from as we have several versions in multiple directories --------- Process name 1201 1 0 Feb 14 ?... (14 Replies)
Discussion started by: mnassiri
14 Replies

3. Shell Programming and Scripting

Problem with find command at ksh

Hi! I made a shell script which is offering menu choice. I made it on RHEL & then with little bit changes I was able to run successfully on AIX/ksh. Script is working fine with no issues other than a little one i.e., There is one choice in which I can list out and delete some files from a... (10 Replies)
Discussion started by: sukhdip
10 Replies

4. UNIX for Dummies Questions & Answers

Compiling Kernel for an Embedded System

-----Edit----- My original post was long and confusing. To sum it up, I am wondering how to do the following Debian based commands on an RPM type system. dpkg -i XXX.deb update-initramfs -k xxx -c update-grub I hope someone can provide some insight. Thanks in advance! --------------... (0 Replies)
Discussion started by: b4sakenxx
0 Replies

5. UNIX for Dummies Questions & Answers

command to find the absolute path

i understand by using the pwd command we get the present working directory. which command is used to find absolute path from home directory to root.. What is absolute path to your and root user's home directory.:confused::confused::confused: (2 Replies)
Discussion started by: shaziafathima
2 Replies

6. UNIX for Dummies Questions & Answers

command to find the path of a file

What is the command to find the path of a file if we know the file name and the root directory where the file resides.. For eg. if a file abc.dat resides in /home/mydir/myfiles/. I am looking for a command which will be fired from / directory, takes abc.dat as input and display the path of... (3 Replies)
Discussion started by: abhilashnair
3 Replies

7. UNIX for Advanced & Expert Users

find command from shell scipt (ksh) problem

Hi experts, I have a simple shell script as follows. #!/bin/ksh FIND_STRING="\( -name 'testfile*.Z' -o -name 'DUMMY_*' \) " find /tmp -type f $FIND_STRING -print When I run this with ksh -x testscript, I get the following output. + FIND_STRING=\( -name 'testfile*.Z' -o -name... (6 Replies)
Discussion started by: kodermanna
6 Replies

8. Solaris

Secure FTP Problem using Sun SSH on Client system F-Secure on Server system

I am using shell script to do secure ftp. I have done key file setup to do password less authentication. Following are the FTP Details: FTP Client has Sun SSH. FTP Server has F-Secure. I am using SCP Command to do secure copy files. When I am doing this, I am getting the foll error scp:... (2 Replies)
Discussion started by: ftpguy
2 Replies

9. HP-UX

URGENT: UNIX FTP cannot find path error

Dear all We are currently working on to install some ERP system in wjhich we need to FTP from unix to windows 2000 machine We run ./lodrun to get files from d/xxxxx/xxxx directory but the ftpoutput.log file shows following error FTP: xxxxxxxxx system cannot find the path specified... (1 Reply)
Discussion started by: minix
1 Replies

10. UNIX for Dummies Questions & Answers

Moving files by splitting the path embedded in the filename

Hello All. I am having a directory /tmp/rahul which contains many files in the format @#home@#rahul@#programs@#script.pl where /home/rahul/programs is the directory where the script.pl file is to be placed. I have many files in this format. What i want is a script which read these... (7 Replies)
Discussion started by: rahulrathod
7 Replies
Login or Register to Ask a Question