problem with FTP Script
Moderators: chulett, rschirm, roy
problem with FTP Script
I have a Sequence where i am using a Execute Command Stage through which i am calling a script to FTP a file from local path to a remote server.
I am passing the following parameters to the script
localpath
localfile
remoteserver
remoteuser
remotepassword
remotepath.
when i execute the sequence,the output for the Execute Command is below
Reply=0
Output from command ====>
XXX: A file or directory in the path name does not exist.
This XXX is the localfile which i need to FTP to the remote server.
When i replace the localpath parameter and hard code the path of XXX in the script it is working fine.
Can any one let me know,what the problem would be.
I am passing the following parameters to the script
localpath
localfile
remoteserver
remoteuser
remotepassword
remotepath.
when i execute the sequence,the output for the Execute Command is below
Reply=0
Output from command ====>
XXX: A file or directory in the path name does not exist.
This XXX is the localfile which i need to FTP to the remote server.
When i replace the localpath parameter and hard code the path of XXX in the script it is working fine.
Can any one let me know,what the problem would be.
Thanks
Sheema
Sheema
Re: problem with FTP Script
Looks like you have some problem while referencing the parameters in the script.sheema wrote:When i replace the localpath parameter and hard code the path of XXX in the script it is working fine.
Post the script if you can.
Narasimha Kade
Finding answers is simple, all you need to do is come up with the correct questions.
Finding answers is simple, all you need to do is come up with the correct questions.
The script is as below
remote_server="${1}"
remote_user="${2}"
remote_passwd="${3}"
remote_path="${4}"
remote_file="${5}"
local_path="${6}"
local_file="${7}"
log_path="${8}"
ftp -v -n $remote_server << eof >> $log_path/$local_file.log
user "$remote_user" "$remote_passwd"
lcd $local_path
cd $remote_path
prompt
put $local_file $remote_file
eof
remote_server="${1}"
remote_user="${2}"
remote_passwd="${3}"
remote_path="${4}"
remote_file="${5}"
local_path="${6}"
local_file="${7}"
log_path="${8}"
ftp -v -n $remote_server << eof >> $log_path/$local_file.log
user "$remote_user" "$remote_passwd"
lcd $local_path
cd $remote_path
prompt
put $local_file $remote_file
eof
Thanks
Sheema
Sheema
1. Make sure you are passing the same value in the Job Properties which you have hardcoded in the script and ran successfully.
2. Check if your local_path default value has any spaces in it?
3. Also you might want to echo all commands and collect them in the local_file.log so that it will be more helpful while debugging. You can figure out how each command was executed.
2. Check if your local_path default value has any spaces in it?
3. Also you might want to echo all commands and collect them in the local_file.log so that it will be more helpful while debugging. You can figure out how each command was executed.
Kris
Where's the "Any" key?-Homer Simpson
Where's the "Any" key?-Homer Simpson
Ok. Now the last thing I can suggest is it might be a permissions issue. Talk to your sysadmin and make sure that the user who is running the datastage job has full access to all the folders within the path. I know you were able to run it while you were hardcoding the full path, but I don't think it is the same as passing the parameters. Last time that happened to me, it was both spaces and then finally permissions issue. So, first check out by yourself if you can drill down to the XXX file right from the C: drive or whereever the file is. If it still continues, we still have to do some thinking.
edited to add: Also, along with what Craig has asked, post what you have in the command window too. who knows!!
edited to add: Also, along with what Craig has asked, post what you have in the command window too. who knows!!
Kris
Where's the "Any" key?-Homer Simpson
Where's the "Any" key?-Homer Simpson
Thanks, wanted to make sure they were properly 'wrapped'.
The reason I asked for your DS version is there is a very well known 'issue' with job parameters in the Execute Command stage. In 'older' versions it will log the translated command correctly, but actually pass the untranslated job parameters to your script.
If you have the base version of 7.5 then you probably are having this issue. It seems to be corrected in the 7.5.1A version, so if that's what you are running then something else may be going on. In either case, I'd suggest you have your script log what it is getting in the way of parameter values so you can diagnose what's going on.
If that is your problem, the 'work around' is to replace the Execute Command stage with a Routine Activity stage that executes the script via the DSExecute function.
The reason I asked for your DS version is there is a very well known 'issue' with job parameters in the Execute Command stage. In 'older' versions it will log the translated command correctly, but actually pass the untranslated job parameters to your script.
If you have the base version of 7.5 then you probably are having this issue. It seems to be corrected in the 7.5.1A version, so if that's what you are running then something else may be going on. In either case, I'd suggest you have your script log what it is getting in the way of parameter values so you can diagnose what's going on.
If that is your problem, the 'work around' is to replace the Execute Command stage with a Routine Activity stage that executes the script via the DSExecute function.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I have done the same thing on 7.5, but on Windows, successfully Craig. So, I don't think it should be any different on Unix and is an issue with this base version. However, logging the script is a good practice which is how I debugged my issues and suggested in my earlier post.
I have a question though for sheema. How are you passing the script to this job? Is it in the command window? If so are you hardcoding the fullpath for the script or did you place the script in the default folder?
I have a question though for sheema. How are you passing the script to this job? Is it in the command window? If so are you hardcoding the fullpath for the script or did you place the script in the default folder?
Last edited by kris007 on Wed Aug 09, 2006 12:31 pm, edited 1 time in total.
Kris
Where's the "Any" key?-Homer Simpson
Where's the "Any" key?-Homer Simpson