On 11/26/10 5:44 PM, John P. Rouillard wrote:
> [..snip..]
> use (note this uses a hard link not symbolic but read on):
>
> #****v* calendar/relink_current
> # SYNOPSIS
> # relink_current - created hard link to newest log file in directory
> # DESCRIPTION
> # Every minute find the most recently written log file and obtain it's
> # inode number.  Obtain the inode number of the file current (which
> # must exist). If they have the same inode number, exit status 0. If
> # they don't force current to be linked to the most recently written
> # log file.
> #******
> type = calendar
> time = * * * * *
> desc = relink current file
> action = shellcmd (/bin/sh -c 'lastfile=`ls -tr ../*.log| tail -n 1`; [ `stat 
> --printf "%i" current` -eq `stat --printf "%i" $lastfile` ] || ln -f 
> $lastfile current')
>
> and use sec -input=current.
>
John, Your action is complicated, but it handles the issue of having a 
dangling reference (I could not see what was happening until I broke out 
'sh -c' as 'sh -xc') .    Assuming that I have a writable spot in the 
same file system, the hard link works.  I will look at stat -L as you 
suggest for handling symbolic  references.

Thanks,
Tim

> I think stat also support the -L flag to dereference a symbolic link,
> so this should work with minor changes if you want to use ln -s rather
> than ln (which you will have to if you are on different
> filesystem). The advantage of this method is that the file that SEC is
> following never changes unless there is a new log file to follow.
>
> (If you don't have stat on your system, the gnu coreutils software
> provides one, or you can use a perl one liner.)
>
[..snip..]

-- 
Tim Peiffer
Network Support Engineer
Office of Information Technology
University of Minnesota/NorthernLights GigaPOP

+1 612 626-7884 (desk)


------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to