Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Frugal install: rotating logs?< Next Oldest | Next Newest >
gjhicks Offline





Group: Members
Posts: 108
Joined: April 2004
Posted: May 21 2006,10:57 QUOTE

Hi,

Am using a frugal install of DSL to run a server.

It is also a samba and vnc server.

The system works just fine but over time (say, 5-10 days) it grinds to a halt.

It seems that the various logs grow to huge sizes.

Most of the 'googled' approaches refer to 'logrotate' but this utility isn't available in DSL.  When I tried to 'apt-get' it, I got lots of nasty looking dependency errors.

Any suggestions gratefully received,

Geoff.
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: May 21 2006,15:03 QUOTE

You could script the rotation from /opt/bootlocal.sh at bootup, or /opt/powerdown.sh to do it at shutdown.  Essentially you'd check the size of each log file, and if it reaches a given size you'd rename it. Something like this, maybe....
Code Sample
LOG_LIMIT=100000 #approx 100k
for i in  /var/log/{logfile1,logfile2,etc}; do
LOG_SIZE=`ls -l $i | awk '{print $5}'`
if [ $LOG_SIZE -gt $LOG_LIMIT ]; then
OLD="$i.`date +%F`"
mv $i $OLD
touch $i
fi
done


NOTICE: this is untested!


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
gjhicks Offline





Group: Members
Posts: 108
Joined: April 2004
Posted: May 23 2006,03:28 QUOTE

Hi,

Thanks for the suggestion.

As I mentioned, the DSL box is being used as a server, so (hopefully!) the bootlocal.sh and powerdown.sh are only very rarely used!

Will have go using crontab to run the script.

Thanks again,

Geoff.
Back to top
Profile PM 
gjhicks Offline





Group: Members
Posts: 108
Joined: April 2004
Posted: May 29 2006,12:13 QUOTE

Hi,

Spent a bit of time getting 'cron' to work with a frugal install, posted a little 'howto' in the 'tips & tricks' forum, called "How to set up 'cron' for a frugal install".

Thanks again for your suggestions and help.

Geoff.
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: May 29 2006,13:53 QUOTE

This is a bit late, but you can set up a script to run at specified intervals using sleep:
Code Sample
while true; do scriptname && sleep 6h || break; done


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
4 replies since May 21 2006,10:57 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: Frugal install: rotating logs?

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code