Forum OpenACS Q&A: ns_logroll

Collapse
9: ns_logroll (response to 1)
Posted by Andrew Piskorski on
Ah, the eternal log rolling question raises it's head yet again. :) Sending a SIGHUP like Don says definitely works (and I used to do it that way), but the best (simplest, easiest, cleanest) way is to use ns_logroll. Here's how I do it on one of my old systems:
ad_proc dtk_roll_server_log {{}} { } { 
   set proc_name {dtk_roll_server_log} 
   # This param controlls how many backups of the server log to keep, 
   # default is 10: 
   #   [ns_config -int "ns/parameters" maxbackup] 
   ns_log Notice "$proc_name: Rolling the server log now..." 
   ns_logroll 
   ns_log Notice "$proc_name: Done rolling the server log." 
} 

ns_schedule_daily 00 00 dtk_roll_server_log 

For OpenACS 4.6, that will work as is, but you should use ad_schedule_proc instead of calling ns_schedule_daily directly, like this:

ad_schedule_proc -schedule_proc ns_schedule_daily \
   [list 00 00] dtk_roll_server_log 

For yet other alternate ways, see these posts (and the threads they are a part of) from back in July and January 2002.