- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script for recycle.
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
11-17-2009 11:16 PM
11-17-2009 11:16 PM
Script for recycle.
I need script to recycle the debug logs after every 30 or 60 minutes. Just rename existing file and keep at least two copies.please proivde me an example of it.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2009 06:22 AM
11-18-2009 06:22 AM
Re: Script for recycle.
if [ -e debug_log.old ]
then
cp debug_log.old debug_log.older
fi
cp debug.log debug_log.old
> debug.log
note:
the reason *not* to use move in this case is that if something has file open, it will continue writing to the .old file.
depending on how often entries are written to the log, you might loose a few when the existing file is cleared with the ">".
once the script works as desired, you can stick it in cron to run at whatever times / intervals desired.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2009 07:08 AM
11-18-2009 07:08 AM
Re: Script for recycle.
Using cron execute the below script according to your timing.
sample script
---------------
#!/usr/bin/ksh
for i in 1
do
cp log copy_1_`date +%Y%m%d%H%M%S`
cp log copy_2_`date +%Y%m%d%H%M%S`
>log
done
Please change the log destinations.
Aneesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2009 01:33 PM
11-18-2009 01:33 PM
Re: Script for recycle.
for i in 1
do
cp log copy_1_`date +%Y%m%d%H%M%S`
cp log copy_2_`date +%Y%m%d%H%M%S`
>log
done
"
uh...doesn't that give you two copies of the same log????
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2009 12:30 AM
11-19-2009 12:30 AM
Re: Script for recycle.
use logrotate tool for this purpose. You can download the depot @
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/logrotate-2.5/
This is very simple, u can play with it easily (and without writing lines of code).
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2009 01:22 AM
11-25-2009 01:22 AM
Re: Script for recycle.
please, since people spent time to provide you help, please, spent your time to assign points:
http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1387538
Rgds,
Art