- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: show date 7 days back for backup
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
Discussions
Discussions
Forums
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
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
тАО11-02-2009 11:16 AM
тАО11-02-2009 11:16 AM
show date 7 days back for backup
The RMAN will remove obsolete older than 7 days.
So before I start my RMAN I want gtar -cvzf the files and off load to storage.
How can I give the title of the gzip file that is 7 days back?
So far I have:
FILES=$(find . -type f -mtime +7)
gtar -cvzf /backups/foo.tgz $FILES
Or can I get it to find files that are ONLY 7 days old.
Also, I want to set the file name for the .tgz file to <7daysold>_backup.tgz
Have no idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-02-2009 11:20 AM
тАО11-02-2009 11:20 AM
Re: show date 7 days back for backup
You can do like this also
find . -atime 7 -exec gzip {} \;
find . -atime 7 -exec tar -cvf backup.tar {} \;| gzip backup.tar
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2009 02:28 AM
тАО11-03-2009 02:28 AM
Re: show date 7 days back for backup
It would just be easier to use the current date and note that it is for the previous 7 days. You can also add that to the name of the file, X-7days.tgz
Clay's caljd script may help:
http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1158025
>Suraj: find . -atime 7 -exec tar -cvf backup.tar {} \;| gzip backup.tar
The use of tar with find isn't apt to work if there are lots of files. Instead use pax(1):
find . -atime +7 | pax -w | gzip > backup.tgz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2009 02:42 AM
тАО11-03-2009 02:42 AM
Re: show date 7 days back for backup
1) to get files that are ONLY 7 days old (take care that this is a modify date not the cretaion date) you have to correctly use the find -mtime option. -mtime option is based on 24 hours, cases are:
find . -mtime 0 # find files modified within the past 24 hours
find . -mtime -1 # find files modified within the past 24 hours
find . -mtime 1 # find files modified between 24 and 48 hours ago
find . -mtime +1 # find files modified more than 48 hours ago
so for you: find -mtime 7
2) to get 7 days ago date you can use the caldj script. Refer to A. Clay Stevenson's script 'Date Hammer' which is found at the bottom of this link:
http://mirrors.develooper.com/hpux/
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-05-2009 08:08 AM
тАО11-05-2009 08:08 AM