- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Deleteing archive files
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
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
тАО08-26-2008 11:27 PM
тАО08-26-2008 11:27 PM
It is increasing every day. But i need to write a bash/perl script and put it in crot tab. The logic is
To check the disk utilization of /u01/archives if it exceeds 80%, then delete the archive files.
Does anyone has this in your environment. How do you manage archive files ? Please share your automation in your env. plz...
Points Points....
Thanks
gV
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-26-2008 11:42 PM
тАО08-26-2008 11:42 PM
SolutionYou can add enrty in Cron which will find files on this FS which will clear/Zip the logs for some time old say 30 days
Entry in Cron
15 00 * * * /usr/bin/find /u01/archives -type f -mtime +30 -exec /usr/bin/compress {} \;
it will compress files
to delete tham
30 00 * * * /usr/bin/find /u01/archives -type f -mtime +90 -exec /usr/bin/rm {} \;
Regards
Sanjeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 12:00 AM
тАО08-27-2008 12:00 AM
Re: Deleteing archive files
You can start with utilisation check
bdf /u01/archives |grep "80%"
if [$i==0]
find files to be deleted
remove files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 12:05 AM
тАО08-27-2008 12:05 AM
Re: Deleteing archive files
Crontab syntax :-
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 05:48 AM
тАО08-27-2008 05:48 AM
Re: Deleteing archive files
If you put on cron on a daily/hourly basis, this might help.
while bdf /u01/archives |grep '8[0-9]%'
do
ls $(ls -1rt /u01/archives/*|head -1)
exit
done
>ls $(ls -1rt /u01/archives/*|head -1)
-replace the first ls with rm to remove
-head -1 is taking the oldest file from the sorted by date list.
increase the number for the number of files you want to remove as per your requirement. You have to make the cron either hourly or daily/weekly as per your data growth.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2008 01:27 AM
тАО10-30-2008 01:27 AM
Re: Deleteing archive files
Please read the following document, may be usefull...
http://docs.hp.com/en/5991-0662/5991-0662.pdf
├в Task 1: Backing Up Your Data Files├в
├в Task 2: Creating an Operating System Recovery Archive├в
Regards,
Gokul Chandola
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-30-2008 01:51 AM
тАО10-30-2008 01:51 AM
Re: Deleteing archive files
Delete all? Or only older ones until below X%?
>Sanjeev: 15 00 * * * /usr/bin/find /u01/archives -type f -mtime +30 -exec /usr/bin/compress {} \;
You can improve it by using gzip and skipping files that were gzipped:
find /u01/archives -type f ! name "*.gz" -mtime +30 -exec gzip {} +
And speed up the rm:
find /u01/archives -type f -mtime +90 -exec rm -f {} +
Checking if > 80%:
if [ $(bdf /u01/archives | awk '/% / {print $(NF-1)+0}') -gt 80 ]; then
echo "greater than 80"
fi