Scenario : How to securely FTP the text file from a particular location(in unix system) to the windows ftp server (my PL is suggesting to use SCP command to accomplish this).
Detailed description:
I have created a Oracle job and scheduled it in dbms_scheduler. The job will invoke the Stored Procedure and the Stored procedure will do some stuff and finally writes a text file(output.txt) into a location called /u03/sachi/extracts/output. Till this I have no problem.
Now I have to write a shell script which does the following stuff
1) securely transfer that file(output.txt) from the location /u03/sachi/extracts/output to a windows ftp server(the machine name and path where I have to copy the file will be decided later). For instance lets say machine name is "sachi" and the path is "C:\Sachi\Winftp\extracts"
(I serached in net for FTPing and got few answers, but my PL wants me to use SCP command)
2)Once the file is "successfully copied/transferred" into windows ftp server then the script should move that file from /u03/sachi/extracts/output to /u03/sachi/extracts/archieve and from "C:\Sachi\Winftp\extracts" to "C:\Sachi\Winftp\archieve". But it should rename the file output.txt to output.txt||datetime(currentdatetime), so that each time I can move files with different names.
I am new to Unix/Linux community(have some basic knowledge). So I have detailed what I want to accomplish.
The file output.txt is available in the location "/u03/sachi/extracts/output". I want to write a shell script which will do secure ftp using scp command as described in my problem description.
The sample code with supporting comments would be of great help.
Well, firstly, can you do any of the following:-
The ping checks that you can resolve the name and route to the host, and that the host can respond. A problem here suggests network routing needs to be looked at from both ends.
If you get a response from the ftp, it will be a plain-text transfer over the network. The sftp uses encryption so is considered secure. It is better, but more complicated to establish. It will, for very large files, improve the throughput as the data is compressed as part of the encryption process.
If you get a 'refused' type message you are not running the server for ftp/sftp on the windows machine.
If you get no response, then eventually (30-40 seconds) you get a 'timed out' type message then there is a network issue, most probably a firewall rule will be blocking you somewhere.
Have a go with the above and post your results. Feel free to cover over anything you deem sensitive, such as ip addresses, server names, user names etc.
Hi All,
I would be happy, if someone help me on this that I have only SFTP ID and Password to transfer some log files from webserver boxes to SFTP server
Anyone help me that how to pass the password parameter throough the shell scripts, since i don't have ssh login access on the SFTP... (2 Replies)
Hi All,
I have done the Private - Public keys generation( and sharing) and have written a script for automating the SFTP. Need to make sure if it will work:
sftp.sh
#!/bin/bash
. config.ini
sftp $SFTP_USER@$SERVER <<EOF
cd $SFTP_RDIR
#ls -lrt | grep $SFTP_RFILE | wc -l
get... (2 Replies)
Hi all ,
can any one tell me how to run a script within a sftp session. let me tell u in bit clear way :
After I connected to sftp location , cd ing to some directory then I need to execute a one script. Please tell me if u have any idea on this .
Looking forward to your reply guys... (1 Reply)
Hi,
I have situation where i need to automate transferring 10000+ files using sftp.
while read line
do
if ; then
echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt
fi
done< files.txt
sftp -b sftpCommand.txt stu@192.168.2.1
The above... (1 Reply)
I am sftp-ing to a server through a shell script from my local machine.
sftp user@host
put out.txt
bye
On executing the script, it prompts to enter the password, and after giving the password it successfully connects to the host.But the problem is that the remaining statements after the... (1 Reply)
did anyone knows a script to get a latest file in a folder,,i try to get the newest file at a folder via sftp and i want to make a crontab to do this once a day,,can someone give me the script to get the latest file?? (5 Replies)
Hi ,
I am able to manually connect to remote system usning "sftp" protocol. But when I using the below command in the script but I am not able to connect.
`sftp TEST01@120.34.3.4`
And the connection should not be closed after login. Please help to solve this.
Thanks
Satya (2 Replies)
Hi,
I want to retrieve files from an sftp site and place it a directory in unix server.
When I try to connect, it is asking password even if i hardcode it in the script.I want to automate the script. Could anyone tell me how to avoid password prompt.
#!/bin/sh
# sample automatic ftp script... (3 Replies)
HI
I need to write script to transefer files from windows server to UNIX and visa versa.... can any one enroute to the solution ........?
I am new to SFTP .. would requst you provide some helpful informaion, Basics of SFTP also appreciated
Thanks in Advance.
Madan (1 Reply)
Hi,
I am trying to use sftp in a ksh - Shell script, but not even a simple script like this returns not output:
sftp username@remotehost <<END
ls
END
If I do something like this:
sftp username@remotehost <<END | tee logfile
ls
END
I get this error message:
Warning: tcgetattr... (1 Reply)