- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell scripting
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
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
04-17-2006 07:08 PM
04-17-2006 07:08 PM
shell scripting
i need some help on shell scripting, currently i have written one script which take backup of some files and place it on one of the other partition with date and time stamp specified on the file name.
i want to know how to make retention period for the same.
shell script is given below
!#/bin/sh
FILENAME=`date +3dpl_lv0_%Y%m%d%H%M`
cp /essbdata1/levzerodata/lev03dpl.txt /essbdata1/back-hyp/${FILENAME}.txt
tar -cvf ${FILENAME}.tar ${FILENAME}.txt
gzip ${FILENAME}.tar
thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2006 07:47 PM
04-17-2006 07:47 PM
Re: shell scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2006 08:12 PM
04-17-2006 08:12 PM
Re: shell scripting
if you want to keep the tar file for 28 days:
cd tar-directory
find . -mtime +28 -exec rm -f {} \;
This finds and removes ALL files which have not been modified in the last 28 days. This also includes any sub-directories.
see man find for more details
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2006 08:19 PM
04-17-2006 08:19 PM
Re: shell scripting
You may use cp -p to preserve date and time of file modifications, and then use 'find -mtime ' to manage retention period.
HTH,
antonio.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2006 09:21 PM
04-17-2006 09:21 PM
Re: shell scripting
if you check the file name, it has been given as year month date hour and minute.
So based on that i need to check the file name.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2006 09:31 PM
04-17-2006 09:31 PM
Re: shell scripting
if you want to use the filename date, you could download a. Clay Stephensons caljd.sh
at http://mirrors.develooper.com/hpux/caljd-2.23.sh
and use the convert date to julian function.
Subtract the filename date from the current date and you would get the "age" of your file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2006 02:27 AM
04-18-2006 02:27 AM
Re: shell scripting
did you try this script can you let me know how this work, bcoz i need to implement those script in production and live servers
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2006 02:46 AM
04-18-2006 02:46 AM
Re: shell scripting
download the latest version caljd-2.25.sh from the same directory and save it as caljd.sh
caljd.sh -help for more help
For your example:
$ ./caljd.sh -y 2006 04 18
2453844
For example if the filedate was 2006 05 17
$ ./caljd.sh -y
2453843
then subtract one from the other and you have the difference in days between the current date and the filename date.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2006 04:29 PM
04-21-2006 04:29 PM
Re: shell scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2006 04:33 PM
04-21-2006 04:33 PM