Article View: alt.pl.comp.os.linux.newbie
Article #361Re: logrotate w slackware 7.1
From: Marcin
Date: Mon, 17 Sep 2001 07:52
Date: Mon, 17 Sep 2001 07:52
43 lines
1809 bytes
1809 bytes
"Krzysztof 'Xyo' Dendra" <krzysztof.dendra@compromis.pl> wrote in message
news:9ns7dp$a3c$1@news.tpi.pl...
: Hi all!
: Problem jak w temacie - gdzie szukać czegoś dokładniej o rotacji logów?
Znalazłem na http://www.slackware.com/
My simple rotation:
#!/bin/bash
function rotatelogs () {
if [ -e $1 ]; then
SIZE=$(/bin/ls -k -s -Q --color=none $1 | /usr/bin/sed -n -e 's/[\"].*//p');
if test $SIZE -gt $MAXSIZE; then
/bin/mv -f $1 $1.old;
/bin/touch $1;
fi
fi
}
MAXSIZE=300
rotatelogs /var/log/messages
if test $SIZE -gt $MAXSIZE; then
/bin/kill -1 `/bin/cat /var/run/syslogd.pid`
fi
Doing a function was kinda overkill, but... Runs in the wee hours through a
root crontab:
# Rotate logs if necessary once a day.
40 05 * * * /etc/misc/logrotate 1> /dev/null 2> /dev/null
Nie wiem co z tego rozumiesz, ale ja jeszcze nie bardzo.
: pozdroofka Xyo
M.
Technical Details
Message-ID:
<9o4a5t$d1g$1@news2.ipartners.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.vogel.pl!newsfeed.tpinternet.pl!news.nask.pl!news.ipartners.pl!not-for-mailReferences:
<9ns7dp$a3c$1@news.tpi.pl>Show Full Headers
Complete Article Headers
From: "Marcin" <betasystem@hoga.pl> Newsgroups: alt.pl.comp.os.linux.newbie Subject: Re: logrotate w slackware 7.1 Date: Mon, 17 Sep 2001 09:52:46 +0200 Organization: Internet Partners Lines: 44 Message-ID: <9o4a5t$d1g$1@news2.ipartners.pl> References: <9ns7dp$a3c$1@news.tpi.pl> NNTP-Posting-Host: mail.chorzow.um.gov.pl Mime-Version: 1.0 X-Trace: news2.ipartners.pl 1000713213 13360 157.25.137.98 (17 Sep 2001 07:53:33 GMT) X-Complaints-To: abuse@ipartners.pl NNTP-Posting-Date: 17 Sep 2001 07:53:33 GMT X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MSMail-Priority: Normal Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.vogel.pl!newsfeed.tpinternet.pl!news.nask.pl!news.ipartners.pl!not-for-mail Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit