Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 04:22 PM
12-03-2003 04:22 PM
On server S1 in direcotry D1 the files get generated every 10 minutes. I need to remotely copy all the files older than 2 hours to the server S2 into a directory D2.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 04:28 PM
12-03-2003 04:28 PM
Re: Script
find ${TmpDirList} -type f -mtime +${OLDEST}
This snippet goes after files more than a certain number of days old.
If you -mtime to -ctime 2 that will allow you to gather a list of files more than two hours old for processing.
find ${TmpDirList} -type f -ctime 2
The TmpDirList parameter is a list of directory to scan.
use the -print command to make a list for further processing.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 04:42 PM
12-03-2003 04:42 PM
Re: Script
Thanks a lot for the quick reply.
I tried as you suggested.
Here is the directory listing.
-rw-rw---- 1 oracle dba 8550969 Dec 4 06:39 arch4473_rprd.log.Z
-rw-rw---- 1 oracle dba 8592471 Dec 4 06:41 arch4474_rprd.log.Z
-rw-rw---- 1 oracle dba 8501743 Dec 4 06:51 arch4475_rprd.log.Z
-rw-rw---- 1 oracle dba 8837264 Dec 4 06:53 arch4476_rprd.log.Z
-rw-rw---- 1 oracle dba 5980036 Dec 4 07:00 arch4477_rprd.log.Z
-rw-rw---- 1 oracle dba 2074509 Dec 4 08:00 arch4478_rprd.log.Z
-rw-rw---- 1 oracle dba 8019762 Dec 4 09:00 arch4479_rprd.log.Z
-rw-rw---- 1 oracle dba 8892805 Dec 4 09:20 arch4480_rprd.log.Z
-rw-rw---- 1 oracle dba 9192857 Dec 4 09:46 arch4481_rprd.log.Z
-rw-rw---- 1 oracle dba 9218013 Dec 4 10:10 arch4482_rprd.log.Z
-rw-rw---- 1 oracle dba 9350541 Dec 4 10:40 arch4483_rprd.log.Z
-rw-rw---- 1 oracle dba 6750444 Dec 4 11:00 arch4484_rprd.log.Z
-rw-rw---- 1 oracle dba 9333897 Dec 4 11:33 arch4485_rprd.log.Z
-rw-rw---- 1 oracle dba 9514487 Dec 4 12:07 arch4486_rprd.log.Z
I tried this⠦⠦⠦⠦⠦⠦
find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 05:32 PM
12-03-2003 05:32 PM
Re: Script
What you need to to use find is by creating a temporary file with the correct mtime by using touch and then do the find with ! -newer
It will look like this:
touch -t 200312040800 /tmp/tmpf
find . ! -newer /tmp/tmpf -print
rm /tmp/tmpf
Biggest issue this will give is of course the creation of the tempfile, since you need to calculate the correct time value. Now this can be done easily with perl:
#!/usr/local/bin/perl
use POSIX qw(strftime);
print strftime("%Y%m%d%H%M",time()-120);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 06:07 PM
12-03-2003 06:07 PM
Re: Script
Thanks for the suggestion. Yes I ca list the file older that the time the temp file was created by tough -t ccyymmddhhmi.
Now I tried to copy these files as
find
I cannot copy like this, as cp will require the source file name.
Any suggestions, to cpoy the listed file along with the find command.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 06:16 PM
12-03-2003 06:16 PM
SolutionElmar solution is of course correct. For time calculation on hours, I've once found a clever tip on the forum :
/homeHA/phelix> echo $TZ
MET-1METDST
/homeHA/phelix> date +'%Y%m%d%H%M'
200312040810 # --> 8 in the morning
/homeHA/phelix> TZ=MET+1METDST date +'%Y%m%d%H%M' # add 2 hours to MET-1
200312040610 # 2 hours earlier !!!
So depending on your TZ value, just use :
touch -t $(TZ=MET+1METDST date +'%Y%m%d%H%M') /tmp/foo
find xxx ! -newer /tmp/foo -exec cp -p {} destination \;
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 06:20 PM
12-03-2003 06:20 PM
Re: Script
use:
find
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 06:25 PM
12-03-2003 06:25 PM
Re: Script
Thanks for your good replies. Jean the script works now. Thanks to all you replied.
Indira
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 11:42 PM
12-03-2003 11:42 PM
Re: Script
I wonder whether Jeans solution with the TZ is supported? ;-) It has another drawback. You can use only that for full hour differences, right? Once I was looking for a solution for a problem just like this. Find is only able to count in days, so I wrote a small c programme which is in the attachment. This will allow you to specify seconds.
Use:
# cat t10
#!/bin/ksh
find /tmp -name '*' -depth -exec ./t101 '{}' ';'
# cat t101
#!/bin/ksh
./fage ${1} 3600 || echo cp -p ${1} "destination"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2003 03:15 AM
12-04-2003 03:15 AM
Re: Script
compile c programme with:
cc -o fage fage.c
it should be 7200 instead of 3600.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2003 10:57 AM
12-04-2003 10:57 AM
Re: Script
There are three different timezones in the /sbin/set_parms.d/10_timezone list which have 30 minute offsets from their neighbors.
Zname[1]=NST3:30NDT
Zfull[1]="Newfoundland Standard/Daylight"
Zname[3]=SAT4:30
Zfull[3]="Venezuela, Guyana, Surinam"
Zname[2]=IST-5:30
Zfull[2]="India"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2003 06:35 PM
12-04-2003 06:35 PM
Re: Script
When using RDIST, you can specify a directory. Rdist then evaluates which, if any of the files in the source (local) directory are not present on the target (remote) directory and then copies them over. RDIST is very simple to configure. You can put the commands in control file, called a dist file, and then run rdist with the -f distfile switch in cron to get consistent results every time.
Good Luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2003 01:03 AM
12-06-2003 01:03 AM
Re: Script
yes, you are right. I know now!!
be happey,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2004 02:34 PM
08-29-2004 02:34 PM
Re: Script
Indira A