[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
The cfengine way of rotating files?
From: |
Julian Simpson |
Subject: |
The cfengine way of rotating files? |
Date: |
Tue, 4 Feb 2003 21:51:06 -0000 |
Hi,
I want to rotate and compress web/app server logfiles on my systems. I
presently use cfengine for tidying directories, disting things like Big
Brother, etc. I am rotating some logs with disable and the rotate=x
option, but I don't want numbered logfiles, I want a date.
I think I want to:
- copy the file to file.YYYY-MM-DD.
(okay, I can do that with the copy command if I can work out a way to
massage the date to that format)
- cat /dev/null into the original file
(disable: and then rotate=empty)
- compress the copy.
(shell command)
The thing is, I only want the actions to happen if the previous actions
completed. And if I come up with an actionsequence of ( copy disable
shellcommands ) and declare all the logfiles in each stanza, how do I do
that?
What I want to be able to do is a shell-like:
for file in "/path/to/file1 /path/to/file2"
do
filenew="$file.`date +%F`"
cp $file $filenew && \
>$file && \
gzip $filenew
done
Is there a way to do this in cfengine, or do I just not grok the
cfengine approach?
Best,
Julian.
Julian Simpson
julian@juliansimpson.org
http://juliansimpson.is-a-geek.org
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
- The cfengine way of rotating files?,
Julian Simpson <=