Antonin,
the script looks OK to me and it is really hard to figure out what's 
wrong here. Let me just make a few points here:

1) the /bin/mv command merely changes the log file name without changing 
the log file i-node, so invoking this command from the script makes no 
difference to SEC.
2) the same goes for touch -- since SEC is writing log messages to an 
already opened file with a given i-node, it does not care whether a new 
log file is created. One additional remark -- calling touch is entirely 
redundant, since SEC will create the logfile itself if it is missing.
3) if SEC continues to write to an old log file, the only possible 
explanation is that it never receives the SIGUSR2 signal. The issue 
can't be explained by incorrect file rights, since if SEC can't open its 
logfile for whatever reason, it will immediately call exit(1).

Having these points in mind, could you check the following two things:
1) in the old log file, there must be a message "SIGUSR2 received: 
restarting logging" with the timestamp when SIGUSR2 signal was sent to 
SEC. Is this message present in the log?
2) in the script, you are fetching the SEC pid from 
/usr/local/CORRELATION/sec.pid. Are you sure this file exists and refers 
to the correct pid?
3) I also noticed that in the script you are always referring to 
external utilities with a full pathname (e.g., /bin/mv), while when 
fetching the pid, the cat utility is used without the full path. Could 
this be the source of the problem?

kind regards,
risto

On 03/19/2010 03:30 PM, antonin mora wrote:
> Good afternoon,
>
> i would like to know what is the best way to have a log rotation with sec.
>
> I tried this :
>
> in my crontab :
>
> #Log rotation for correlation
> 59 23 * * * /usr/local/CORRELATION/rotateLogs.sh
>
> in 'rotateLogs.sh' :
>
> #!/bin/ksh
> ############################
>
> /bin/mv /usr/local/CORRELATION/logs/sec.log
> /usr/local/CORRELATION/logs/sec.log.`date +%F`
> /bin/touch /usr/local/CORRELATION/logs/sec.log
> /bin/kill -SIGUSR2 `cat /usr/local/CORRELATION/sec.pid`
> exit 0
>
> in my log directory :
>
> [r...@tqwdgc01x /usr/local/CORRELATION/logs]# ls -l
> total 3135216
> -rw-r--r--  1 root root    670446 Jan 26 10:46 dump.log
> -rw-r--r--  1 root root         0 Mar 18 23:59 sec.log
> -rw-r--r--  1 root root 130506115 Feb 11 11:07 sec.log.2010-02-10
> -rw-r--r--  1 root root 112122200 Feb 12 10:49 sec.log.2010-02-11
> -rw-r--r--  1 root root 105520789 Feb 13 09:29 sec.log.2010-02-12
> -rw-r--r--  1 root root 307281617 Feb 15 11:34 sec.log.2010-02-13
> -rw-r--r--  1 root root         0 Feb 13 23:59 sec.log.2010-02-14
> -rw-r--r--  1 root root 128697038 Feb 16 14:46 sec.log.2010-02-15
> -rw-r--r--  1 root root 128723028 Feb 17 13:53 sec.log.2010-02-16
> -rw-r--r--  1 root root  90556168 Feb 18 09:02 sec.log.2010-02-17
> -rw-r--r--  1 root root 120542397 Feb 19 10:37 sec.log.2010-02-18
> -rw-r--r--  1 root root 341591518 Feb 22 12:01 sec.log.2010-02-19
> -rw-r--r--  1 root root         0 Feb 19 23:59 sec.log.2010-02-20
> -rw-r--r--  1 root root         0 Feb 20 23:59 sec.log.2010-02-21
> -rw-r--r--  1 root root 111071320 Feb 23 11:30 sec.log.2010-02-22
> -rw-r--r--  1 root root 132737580 Feb 24 15:07 sec.log.2010-02-23
> -rw-r--r--  1 root root  86991916 Feb 25 08:53 sec.log.2010-02-24
> -rw-r--r--  1 root root 122497795 Feb 26 10:39 sec.log.2010-02-25
> -rw-r--r--  1 root root 639773639 Mar  3 23:35 sec.log.2010-02-26
> -rw-r--r--  1 root root         0 Feb 26 23:59 sec.log.2010-02-27
> -rw-r--r--  1 root root         0 Feb 27 23:59 sec.log.2010-02-28
>
> Sometimes it works, but sometimes the rotation doesn't work, sec keeps
> on writing into the previous log file and the new log file stays
> empty.
>
> Best regards,
>
> Antonin.
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Simple-evcorr-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users
>


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Simple-evcorr-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to