cronolog.org
flexible web log rotation
HOME
DOWNLOAD
FEATURES
USAGE
FAQ
BLOG
KNOWN BUGS
SECURITY
PATCHES
USERS
TO DO
HISTORY
LINKS
FEEDBACK
MAILING LIST
ADVERTISING

support cronolog development



Google   HELP


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: multiple symbolic links....?



If you decide to take this route via Perl, you'd probably find the Date::Calc module invaluable.  Check your local CPAN.  I know from experience that it's far too easy to overlook something when rolling your own date functions ;-)
At 08:58 AM 1/11/01 +0000, Ben Dimmock wrote:
>This is more of a *nix thing that a cronolog thing - unless I've got the
>wrong end of the stick.
>
>I imagine you want /var/log/log.old to point to last months log, and
>/var/log/log.new to point to this months (and this changes every month)...
>
>What I would do, is write a perl script along the lines of:
>
>------------------------------------------------------------------
>#!/path/to/perl
>
>$month = getthismonth(); # write this function
>$year  = getyear();      # write this function
>
>system ("\ln -s /logs/$year/$month/logfile.log /var/log/log.new");
>
>if (--$month == 0) {
>  $year--;
>  $month = 12;
>}
>
>system ("\ln -s /logs/$year/$month/logfile.log /var/log/log.old");
>------------------------------------------------------------------
>
>and stick this in a crontab like:
>
>------------------------------------------------------------------
># run script at midnight on 1st of every month:
>0 0 1 * * /path/to/script
>------------------------------------------------------------------
>
>I'd check on the syntax (just woke up) but I hope this helps.
>
>Ben Dimmock
>Systems Software Engineer
>--
>Reality42: 12 Furber Street, London, W6 0HE, UK
>Telephone: +44.70.9212.1874
>Facsimile: +44.70.9218.0488
>E-mail   : mailto:ben@xxxxxxxxxxxxx
>Web site : http://reality42.net
>
>
>-----Original Message-----
>From: owner-cronolog-users@xxxxxxxxxxxxxxxxxx
>[mailto:owner-cronolog-users@xxxxxxxxxxxxxxxxxx]On Behalf Of Joseph
>Nadler
>Sent: 11 January 2001 06:03
>To: cronolog-users@xxxxxxxxxxxxxxxxxx
>Subject: multiple symbolic links....?
>
>
>Hey!
>
>Anybody know if it's possible to have cronolog link multiple months to one
>directory? e.g. -
>
>/logs/2000/12/logfile.log -> /var/log/log.old
>/logs/2001/01/logfile.log -> /var/log/log.new
>
>Anyone? :-)
>
>Joseph Nadler
>joseph@xxxxxxxxxxxxxxxxxxxx
>Solutions Central
>Level 5, 96 Albert street
>Po Box 440
>Albert Street BC 4002
>Ph: 3307 6666
>Fax: 3307 6600

Copyright © 1996-2010 Andrew Ford and Ford & Mason Ltd