Click to See Complete Forum and Search --> : Slack7.1 Logrotate
Harvey
01-14-2001, 09:53 PM
Where do I get logrotate? I searched freshmeat and i can't find it on there... and isn't that something that should be installed by default? i'm running slack7.1
whereis logrotate and locate logrotate turn up nothing... geh.
X_console
01-14-2001, 11:43 PM
There isn't one. http://www.linuxnewbie.org/ubb/smile.gif logrotate comes with RedHat. Try making a search for it using your search engine, you should get something. Or you could write your own script, like I did. It's not very difficult. Here's the low down on how it works:
1. your script should basically check the size of files in /var/log/ and if they're too big, compress them.
2. it runs at specific time periods, eg: once a day. You can accomplish this by having crontab run your script.
Here's an example:
#!/bin/bash
# log file to check:
FILE=/var/log/messages
# size of logfile:
SIZE=$(du -h $FILE | awk '{print $1}'
# if the logfile reaches beyond this size (1MB) it gets compressed:
TOOBIG=1024
if [ "$SIZE" -gt "$TOOBIG" ]; then
tar cvzf $FILE-$(date '+%D%H%M).tar.gz $FILE
fi
Eventually you may also want your script to check if a compressed file has been around for too long, and then have it delete the file.
sssadams
01-15-2001, 12:03 AM
goto www.linuxmafia.org (http://www.linuxmafia.org) and do a search for logrotate.They have a slackware package you can install.The directions are pretty simple.
iDxMan
01-15-2001, 12:14 AM
I have the source for v3.3 if you want it. I can either email or ftp to a website for ya...
Some links from redhat: (v3.5.2)
http://www.redhat.com/swr/src/logrotate-3.5.2-1.src.html
http://www.redhat.com/swr/i386/logrotate-3.5.2-1.i386.html
When I installed Slack7.1 I did put in rpm support so with that you should at least be able to extract stuff from the rpm, then do whatever you want from there..
(edit: better yet, just get the tgz from linuxmafia. I guess I didn't see that post before. http://www.linuxnewbie.org/ubb/biggrin.gif )
-r
[This message has been edited by iDxMan (edited 14 January 2001).]
X_console
01-15-2001, 08:29 AM
By the way, if you want to use the RPM, but didn't install RPM support into Slack, just use the "rpm2tgz" program to convert it into a tgz file.
Harvey
01-15-2001, 11:07 AM
wow I didn't know where was a rpm2tgz program, that's phatty.
I think I"ll go to linuxmafia and get the slackpack... as soon as I finish my homework anyway. Lame.