All Forums |
Register |
Login |
Search |
Subscriptions |
My Profile |
Inbox |
Tool Warehouse |
FAQs |
Resources |
Help |
Member List |
Address Book |
Logout |
|
|
Limiting the cron log file
|
Logged in as: Guest |
Users viewing this topic: none |
|
Login  |
|
|
Limiting the cron log file - Jan. 23, '03, 12:03:11 PM
|
|
|
stowery
Posts: 1
Joined: Jan. 23, '03,
Status: offline
|
I am looking for some advice regarding how to best limit the size of the cron log file in Interix. I want to use the logging feature, but I want to avoid having the cron create a really huge log file. What is the best method for avoiding this situation? Is there a configuration setting which allows the user to impose a file size limit just on the cron log? Is it necessary to write a script to move the cron log to another filename, delete the file, and create a new file?
Thanks in advance for any suggestions.
Stuart
|
|
|
RE: Limiting the cron log file - Jan. 23, '03, 12:50:21 PM
|
|
|
Rodney
Posts: 3728
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
|
The most straightforward thing to do is roll the log file after a certain number of days. Done with cron itself of course.
You' ll want the cron job to send a SIGHUP at the cron daemon.
The PID is in the file " /var/run/cron.pid" .
You likely want have a couple of " rolls" to make it so data doesn' t disappear too quickly. So something like:
mv /usr/lib/cron/cron.log.1.gz /usr/lib/cron/cron.log.2.gz
mv /usr/lib/cron/cron.log /usr/lib/cron.log.1
kill HUP `cat /var/run/cron.pid`
gzip /usr/lib/cron/cron.log.1
for your cron job once a week or whatever timeframe you like. The gzip is just to save some space -- only do the gzip after the HUP otherwise cron will still be writting to it.
- Rodney
|
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
|
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts |
|
|
|