Help with script periodically pushing files from one host to another
Dear all,
I would like to write a script to push periodically some downloaded files from one host to another box.
Basically, I have host A downloading files.
When those files are downloaded they are moved automatically to a directory called: /home/user_A/downloaded, still on host A.
Then I need to move all the files in the downloaded directory from host A to host B, furthermore I want to clear up the downloaded directory on host A, as otherwise there won't be enough space there for future downloads.
So I want to write a shell script that:
1) periodically push all the files from the downloaded directory on host A to host B
2) Afterwards deletes all the files in the downloaded directory of host A
What is the best way to do that?
I would like to call this "push.sh" script, every hour in a cron job on host A:
My problem is: How to be sure that all the files are going to be completely transferred to host B before they are deleted on host A???
What should I do to be sure that the scp command is finished before executing the rm -f * command??
Many thanks for your help and keep up the good work!
Hi
I am trying to a write a script which gives message queue depth for every 5 mins in a file.
Commands that I use are
runmqsc QM_Name
display ql(*) curdepth
Since I can use only MQSC commands I need help on how to fetch the output on to a file after executing display command. (3 Replies)
ok, I'm new to the forum and I did a few searches and didn't find much on this so here goes.
I have a ksh I use to call an expect script that opens a ssh session and then extracts a tar file. The tar file has my prefered .profile and my ssh keys. I want to run this script 1 time on new servers and... (2 Replies)
Hello....
I have two servers, one has an empty / and the other has a subdirectory with a large number (4 gig) with many, many files. I need a way to transfer the files en masse from the server with the large number of files to the one that is essentially blank.
I don't have space on the used... (16 Replies)
OK, I am a little new to AIX 5.3 and also to scripting. I have a shell script that I wrote and am having difficulty pushing specific files by the system date. Here is my script:
#!/usr/bin/sh
RSYNC=/usr/local/bin/rsync
SSH=/usr/local/bin/ssh
KEY=<path> somekey.key
RUSER=mike... (4 Replies)
Hi Folks Interesting question hope u get the ans:
I have to ftp a file ABC(Timestamp) to server XYZ
My script should be doing the every 2 hours.
after the transfer I need to confirm whether the file ABC(timestamp) got transfer properly or not.
My concern is after the "put ABC"... (7 Replies)
I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Hi, I'm wondering if there's a way to send a command periodically to remote server through a script.
Right now I have this:
keepLooping=1
ssh user@domain
while (( keepLooping == 1 ))
do
echo a
sleep 3
done
but what this does is ssh to the server, and only when the connection is... (2 Replies)
Hi,
I am looking for a C library feature, to which I can say execute a function every 10 seconds.
for Eg
#include <timer_lib.h>
fun1(){
printf("I am still cool ");
}
int main(){
run(10,&fun1); // Should register & execute the function fun1 every 10 seconds
return 0x0;
}... (24 Replies)
Hi all,
i am copying .gz files from production server to development server using
"scp" command.my requirement is after copying .gz files i want to delete old
.gz files(two days back) in development server from production server.
like this way i need to delelte .log ,.z and .dmp files... (3 Replies)
We have a strange problem that started happening a few months ago. We have a unix script being called from within a microfocus cobol program using the call "SYSTEM" cobol command. The problem is sometimes the script will run, sometimes it wont - without us changing anything! The other strange... (1 Reply)