I am writing a shell script to copy sybase related .dump files from one to another aix server and visa versa.
Please help me do the following
The script does the following:
- check directory exists
- copy dump files
- copy is done for multiple database
- checks databases, if one database does not exist, the script should skip that database and move to the next database.
Started the script:
==============
===================
---------- Post updated at 11:41 AM ---------- Previous update was at 11:29 AM ----------
Main part is looking to LOOP thorough all databases :
????????????????????????????????????
Here i have to put FOR or WHILE LOOP
# Loop through for all databases (eg: central ltts pass rd1 rpt1 teraview1 tvstage workdb)
# Skip if the one database does not exist
????????????????????????????????????
---------- Post updated at 12:14 PM ---------- Previous update was at 11:41 AM ----------
I don't think sftp will accept this format (often called a HERE):-
You may have to put the commands in a batch file and refer to them with a -b flag. The sftp will also abort if there is an error and you can check for that.
You will have to ensure that when you manually run sftp sybase@${REMOTE_HOST} that it connects you without prompting for authentication. Do the local cd before you start sftp and your batch file can then just contain:-
I'm not sure that you can code variables into it, but you could easily build it each time.
For your loop, what feeds into it? If the database names are in a file, then you could wrap that section in :-
If you need to skip if the file to send doesn't exist, just remove the exit 1 statement as this will terminate your script. I think you have a suitable test for file existing already.
Just using the code you put up, I was looking at this bit:-
Do you have a list of the files you want to try to send, or if they're all in one place, is there anything else in that directory?
The loop could be based on either, or even the parameters on the command line like yours might be.
Greetings Experts,
I am working for a bank client and have a question on connect-direct and SFTP.
We are using Linux RedHat servers. We use connect-direct to transfer (NDM) files from one server to another server. At times, we manually transfer the files using SFTP from one server to another... (2 Replies)
Hi
Could you please help me out how to configure between two server I don't have admin idea to setup the Sftp server
the requirements is we want to send a file to vendor so we need sftp configuration so that can we can send file through sftp
Please let me know what should I ask to vendor... (1 Reply)
Hi,
I have to check the files in another server using sftp to do that, below is the code i am going with
#!/bin/bash
export SRC_FOLDER=$1
export ARC_FOLDER=$2
HOST=as07u3456
USER=relfag
sftp ${USER}@${HOST} <<EOF
cd $SRC_FOLDER/DSCOR
ls
bye
EOF
echo "done"
whatever the files i... (8 Replies)
Hi,
In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this?
I am using #!/bin/ksh
For eg: sftp user@host <<EOF
cd /path
get *.txt
rename *.txt *.txt.done
... (7 Replies)
Hello,
I have a weird issue, I have RHEL 5.7 running with openssh5.2 where sftpgroup OS group is chroot. I see the difference difference in timestamp on files, when I login via ssh and SFTP, I see four hour difference, is something missing in my configuration.
#pwd... (8 Replies)
Hi,
I need to write a unix shell script which sends files to a server1 from my server via sftp. Then it needs to again SFTP files from that server1 to another server2. And finally remove the transferred files in the intermediate server1. Please provide me pointers on how to achieve the same. All... (3 Replies)
Hi,
I need to calculate time taken by a 100kb file for sftp between two servers. I am new to unix can some body please tell me how do this.
Thanks in advance...
Vivek (2 Replies)
I have four servers that for all intents and purposes are the same (I have the same profile on all four), North, South, Brooklyn & Queens.
I have a script that scp's a file from Queens to brooklyn, and it runs just fine. I tried to replicate the script on South, to transfer a file to North, and... (1 Reply)
Hello everyone,
Have a question which I'm not entirely sure about, but will ask anyway.
We have three servers (A/B/C), 'A' being the local host, 'B' being a SFTP server on the DMZ, and 'C' being the intended remote host. The task is to transfer file/s from server 'A' to server 'C' via server... (0 Replies)