01-16-2009
Shell script to transfer the files from source to target server.
I need to write a shell script to transfer the files every hour from source - target server.
The cron job should be running every hour and shouldn't copy already copied files to the remote server ?
I was able to write intial script but not able to get the logic for (in the next run it should copy only newly created files with in that hour)
Here is the logic:-
for I in `ls`
do
echo $I - Log from cron
scp $I pluto@5.67.16.25:$REMOTE_LOC/
sleep 120
done
Thanks,
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is
# echo $0
-sh
My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies
2. Shell Programming and Scripting
Hi,
I am new to DB2 and in need of urgent help.
Here we have about 100 queries (SQL) that have been manually executed to retrieve totals from different tables
and post it to Excel spreadsheet. Is there any way I can create a shell script as a wrapper and execute
these queries and create a... (5 Replies)
Discussion started by: bhaskar v
5 Replies
3. Shell Programming and Scripting
Hello,
I need help in writing the shell script for below mentioned case.
There are 2 servers(server A, server B).
A cronjob syncs files between these 2 servers.
Existing script is copying files from A to B.
This is done using the command rsync.
However, the files are not deleted... (2 Replies)
Discussion started by: SravaniVedam11
2 Replies
4. Post Here to Contact Site Administrators and Moderators
Hi guys...please any one help me ....
how to copy files from source to target location
if 5 files copied successfully out of 10 files then implement success=10
and if remaining 5 files not copied successfully then count error=5
how to implement this condition with in loop
i need code linux... (0 Replies)
Discussion started by: sravanreddy
0 Replies
5. UNIX for Dummies Questions & Answers
Hi Guys,
how to count number of files successfully copied while coping files from source to destination path
ex:10 files from source to target location copying
if 8 files copied successfully then
echo successfully copied=8
failure=2 files
if two files get error to coping files... (2 Replies)
Discussion started by: sravanreddy
2 Replies
6. Shell Programming and Scripting
Hi
I have the following script:
#!/bin/sh
set -x
touch -mt 201210040000 /tmp/ref1
touch -mt 201210042359 /tmp/ref2
find /fs1/bscsrtx/BSCS_ix/WORK/LOG -type f \( -newer /tmp/ref1 -a ! -newer /tmp/ref2 \) > file_lst
scp $(< file_lst) root@10.100.48.76:/ano2005/fs1_2015/LOG/
but somehow its... (7 Replies)
Discussion started by: fretagi
7 Replies
7. Shell Programming and Scripting
Hello to all,
I want to copy from one server to another files of last 24 hours with size between 500MB and 2GB. The code below searches last files in 24 hours.
find . -mtime -1
In order to copy faster I'd like to compress the files before copying them.
How to automate the process of... (8 Replies)
Discussion started by: Ophiuchus
8 Replies
8. Shell Programming and Scripting
Hi Guyz ,,
I'm an ERP functional guy , I really need to automate a script which required a shell script but have a little knowledge in shell scripting.
I need my generated files to be zipped first in one directory lets say (xyz) and then it needs to transfer another ftp server in... (3 Replies)
Discussion started by: Shogundion
3 Replies
9. Shell Programming and Scripting
Dear Experts
my scenario is as follows...
I have one source folder "Source" and 2 target folders "Target_123456" & "Target_789101". I have 2 series of files. 123456 series and 789101 series. Each series has got 3 types of fiels "Debit", "Refund", "Claims".
All files are getting... (17 Replies)
Discussion started by: phani333
17 Replies
10. UNIX for Beginners Questions & Answers
i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Discussion started by: malaika
2 Replies
ypxfr(1M) ypxfr(1M)
NAME
ypxfr, ypxfr_1perday, ypxfr_1perhour, ypxfr_2perday - transfer NIS database from server to local node
SYNOPSIS
domain] host] domain]
tid prog server] mapname
Remarks
The Network Information Service (NIS) was formerly known as Yellow Pages (YP). Although the name has changed, the functionality of the
service remains the same.
DESCRIPTION
copies a Network Information Service (NIS) map (database) to the local host from a NIS server by using the NIS services. A map can be
copied regardless of its age, or it can be copied depending on whether its modification time (order number) is more recent than that of the
local map.
The command creates a temporary map in directory where domain is the NIS domain. The command fills the map with mapname entries, obtains
the map parameters (master and order number), and loads them. It then clears the old version of mapname and moves the temporary map to the
existing mapname.
If is run interactively, it writes messages to standard output. If is invoked without a controlling terminal and if the log file exists,
appends all its messages to that file. Since is usually run from the superuser's file (see crontab(1)) or by (see yppush(1M)), the log
file can retain a record of what attempted and what the results were.
To maintain consistency between NIS servers, should be executed periodically for every map in the NIS database. Different maps change at
different rates. For example, the map may not change for months at a time, and might therefore be checked for changes only once a day,
such as in the early morning hours. However, may change several times per day, so hourly checks for updates might be more appropriate.
A file can perform these periodic checks and transfers automatically. Rather than having a separate file for each map, requests can be
grouped in a shell script to update several maps at once. Example scripts (mnemonically named) are in and They serve as reasonable rough
drafts that can be changed as appropriate.
Refer to ypfiles(4) and ypserv(1M) for an overview of the Network Information Service.
Options
recognizes the following options:
Preserve the resolver flag in the map during transfer.
Do not send a "clear current map" request to the local
process. Use this flag if is not running locally when you are running Otherwise, complains that it cannot talk to
the local and the transfer fails. If is running locally, do not use this flag.
Copy the map from a NIS server in
domain rather than the domain returned by (see domainname(1)).
Force the map to be copied, even if its order number at the remote NIS
server is not more recent than the order number of the local map.
Obtain the map from
host, regardless of its master server. If this option is not used, asks the NIS service for the master's host name
and tries to obtain its map. The host can be a name or an IP address of the form
Specify a source domain from which to transfer a map that should be
the same across domains (such as the map.
When invokes it specifies that should call back a process (that initiated the transfer) at the host server, registered as
program number prog, and waiting for a response to transaction tid.
AUTHOR
was developed by Sun Microsystems, Inc.
FILES
Log file
The following scripts are suggested for use with
Run one transfer per day
Run two transfers per day
Hourly transfers of "volatile" maps
SEE ALSO
crontab(1), domainname(1), cron(1M), ypinit(1M), yppush(1M), ypserv(1M), ypfiles(4).
ypxfr(1M)