Visit Our UNIX and Linux User Community

2 ftps in script, second won't go to output file

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers 2 ftps in script, second won't go to output file
# 1  
Old 11-15-2007
2 ftps in script, second won't go to output file

I'm running this on both solaris and hp boxes, ftping from windows, then ftping to an aix machine.
If I run the ftpReportFile by itself, I get info in the ftp_rpt_log. If I run just the 2 ftps together, I also get output. However, if I run the entire shell script, I don't get output from ftpReportFile. And ftpReportFile is failing saying it can't find the file. Please help.

ftpEngine() {
ftp -inv ${FTP_SERVER} << EOF_FTP >> ${FTP_LOG}
user ${FTP_USER} ${FTP_PSWD}
cd ${FTP_DIR1}
cd ${FTP_dir2}
mget ${FTP_FILE}
mv engine.tar.Z $HOME/"$CURRENT_VERSION"/"$test_type"/engine.tar.Z

ftpReportFile() {
ftp -inv ${FTP_REPORT_SERVER} << EOF_FTP > ${FTP_RPT_LOG} 2>&1

error when I do get output:
Connected to xxxx.
220 xxxx FTP server (Version 4.1 Thu Jun 21 14:19:12 CDT 2007) ready.
331 Password required for qainst01.
230-Last unsuccessful login: Tue Nov 13 15:10:58 EST 2007 on /dev/pts/0 from xxxxx
230-Last login: Thu Nov 15 12:58:03 EST 2007 on ftp from xxxx
230 User qainst01 logged in.
250 CWD command successful.
257 "/home/qainst01/50" is current directory.
200 Type set to I.
200 PORT command successful.
553 /export/home/qainst01/50/SUN_50_Report.txt: A file or directory in the path name does not exist.
221 Goodbye.

$ pwd
$ ls SUN*                   SUN_50_log.txt              SUN_50_previous_log.txt     SUN_50_Previous_Report.txt  SUN_50_Report.txt

# 2  
Old 11-15-2007
Post result of

ls -ld /export/home/qainst01/50/SUN_50_Report.txt

# 3  
Old 11-15-2007
$ ls -ld /export/home/qainst01/50/SUN_50_Report.txt
-rw-r--r--   1 qainst01 other        685 Nov 15 12:36 /export/home/qainst01/50/SUN_50_Report.txt

# 4  
Old 11-15-2007
Instead of listing the full path to the file in $REPORT_FILE you may want to

ftpReportFile() {
ftp -inv ${FTP_REPORT_SERVER} << EOF_FTP > ${FTP_RPT_LOG} 2>&1
lcd ${LOCAL_DIR}

# 5  
Old 11-15-2007
The reason I had the whole path is to make the script as maintainable as possible. I have to use it in like 16 different places. Here's the declarations.


I'll be handing this off to another group that doesn't do any scripting in Unix and they need to just change the first few values and run it. If you know how to make it less confusing, let me know.

Previous Thread | Next Thread
Test Your Knowledge in Computers #239
Difficulty: Easy
In March 1970, the ARPANET reached the East Coast of the United States, when an IMP at the Department of Energy in Washington, DC was connected to the network.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script won't run because hardware won't produce display

Can anyone offer any advice on how to modify the script below to work on a new system we have, that has no graphics capability? We admin the system through a serial RAS device. I've tried running the below script through the RAS and through an ssh -X session. It failed with something like "GTK... (3 Replies)
Discussion started by: yelirt5
3 Replies

2. UNIX for Advanced & Expert Users

Best way to transfer files to remote FTPS server instead of local FTPS server

Hi, I am working on an application which runs on an Informatica Red-Hat 5.10 Linux Server. The application involves several Informatica ETL workflows which generate 100s of Text files with lot of data. Many of the files will each be up to 5 GB in size. Currently the Informatica server itself... (7 Replies)
Discussion started by: waavman
7 Replies

3. Shell Programming and Scripting

File transfer using FTPS(SSL)

Hi Team, I am currently working on an integration project where in we have planned to receive files from an external source onto our system via FTPS(SSL). I am new to this part and would like to know the points for consideration and the points to learn to get this done. The files we receive from... (1 Reply)
Discussion started by: Rads
1 Replies

4. Shell Programming and Scripting

FTPS Connection script

I have a requirement for which I had to connect to a server using FTPS. I have been provided with these, connection method: FTPS Server Name Port for explicit and implicit Login user I would like to know the FTPS command/script in order to connect to there server and get a file. ... (5 Replies)
Discussion started by: r@v!7*7@
5 Replies

5. UNIX for Dummies Questions & Answers

Ftps connection by ksh script

Hi, I'm trying to access to FTP SERVER over SSL with this script unix : (credentials are correct) #!/usr/bin/ksh USER="test" PASSWORD="pwdtest" IP="**.***.*.***" ftp -s $IP 990 << EOF >>log_ftp user $USER $PASSWORD bin passive EOF but seems that credentials are not passed... (2 Replies)
Discussion started by: nash83
2 Replies

6. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

7. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

8. Shell Programming and Scripting

FTPS Script to move a file to Unix Folder

Dear Experts, I need to connect to a FTPS Server and move the files from FTPS folder "/SAP/Out" to Unix directory "/SAP/In". I need to run this script on Unix directory...Script should get the files from FTPS folder and place that in specified Unix Directory. Thanks In Advance. (1 Reply)
Discussion started by: phani333
1 Replies

9. Shell Programming and Scripting

Help needed in shell script for FTPS

Hi, Im trying to build a script to download files from a secure FTP site. When I run the command ftps <host_address> in the unix prompt, it asks username and password, and then prompts the following question. Do you want to trust this certificate? (y): From the prompt, I am able to type... (10 Replies)
Discussion started by: vidhya_vec
10 Replies

10. Shell Programming and Scripting

scp output fm script won't go to file

Have a script that scp's tar file to multiple other servers in a for loop. Need to set monitoring and notification on it for when it fails. Running this line of code in a 'for' loop... scp $SOURCE_RECOVERY_TARFILE ${HOST}:${CURR_RECOV_TARFILE} 2>&1 | tee ${MONFILE} Their are two outputs... (7 Replies)
Discussion started by: nmikes
7 Replies

Featured Tech Videos