Jesús Arnáiz wrote:

I use a simple script like:

---------/admin/rotar-qscanner.sh---------------
#!/bin/sh
cd /var/spool/qmailscan
if [ -f qmail-queue.log.gz.10 ]; then
rm -f qmail-queue.log.gz.10
fi
if [ -f qmail-queue.log.gz.09 ]; then
mv qmail-queue.log.gz.09 qmail-queue.log.gz.10
fi
if [ -f qmail-queue.log.gz.08 ]; then
mv qmail-queue.log.gz.08 qmail-queue.log.gz.09
fi
if [ -f qmail-queue.log.gz.07 ]; then
mv qmail-queue.log.gz.07 qmail-queue.log.gz.08
fi
if [ -f qmail-queue.log.gz.06 ]; then
mv qmail-queue.log.gz.06 qmail-queue.log.gz.07
fi
if [ -f qmail-queue.log.gz.05 ]; then
mv qmail-queue.log.gz.05 qmail-queue.log.gz.06
fi
if [ -f qmail-queue.log.gz.04 ]; then
mv qmail-queue.log.gz.04 qmail-queue.log.gz.05
fi
if [ -f qmail-queue.log.gz.03 ]; then
mv qmail-queue.log.gz.03 qmail-queue.log.gz.04
fi
if [ -f qmail-queue.log.gz.02 ]; then
mv qmail-queue.log.gz.02 qmail-queue.log.gz.03
fi
if [ -f qmail-queue.log.gz.01 ]; then
mv qmail-queue.log.gz.01 qmail-queue.log.gz.02
fi
if [ -f qmail-queue.log ]; then
/usr/bin/gzip -9 qmail-queue.log
fi
if [ -f qmail-queue.log.gz ]; then
mv qmail-queue.log.gz qmail-queue.log.gz.01
fi
------------------

And then I put on the root crontab:

0 23 * * * /admin/rotar-qscanner.sh

----
*(See the path of files and binaries may vary depends on your system)

As you can see, it runs every day, so you save last ten days; If you use it weekly you save last ten weeks...


I read it on a web page but I don't have it here, sorry


Regards!!!


Jesus Arnaiz



David A Gartner wrote:


cat /dev/null > /path/to/qmail-queue.log

Works wonders to clear it out real quick... but you have to repeat this
as it fills up (fast).

Turning off debug is best for production; it can be re-enabled at any
time if you need it

David A Gartner ([EMAIL PROTECTED])
Foundation Technologies
"The eye sees only what the mind is prepared to comprehend."


-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, March 02, 2004 12:45 PM To: [EMAIL PROTECTED] Subject: Re: [Qmail-scanner-general]How do I rotate qmail-queue.log?

Hmm I just delete the file or move it depending on my mood and it just
goes
on and makes a new logfile itself.
As far as I know that is the correct qmail-scanner behaviour..
No need to restart anything.

----- Original Message -----
From: "russ" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 02, 2004 4:45 PM
Subject: Re: [Qmail-scanner-general]How do I rotate qmail-queue.log?



On Tue, 2004-03-02 at 08:37, Brian Hoover wrote:


The problem I'm trying to solve is rotating the qmail-queue.log


file. My rotate script creates a new file sets the owner & permissions then moves the original file and moves the new file to qmail-queue.log.

cd /var/spool/qmailscan
touch ./qmail-queue.log.1
chmod 600 ./qmail-queue.log.1
chown qscand:root ./qmail-queue.log.1
mv ./qmail-queue.log ./qmail-queue.log.uc
mv ./qmail-queue.log.1 ./qmail-queue.log

The problem is that the log is not used until I restart qmail.
How should this file be properly rotated?


Don't delete the file. Instead, copy it if you want a back log. Then
Just pipe text into the old file.

ie:

cp /var/log /var/log.1
echo "restart" > /var/log

You are right, if you delete the file, you have to restart qmail.

--
Russel Oliver
[EMAIL PROTECTED]
http://www.techsane.com



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Qmail-scanner-general mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general





-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Qmail-scanner-general mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general




------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Qmail-scanner-general mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Qmail-scanner-general mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general


Dear Jesus Arnaiz fidodido, I think that it's better to use some kind of existing tools like logrotate, that its include in every unix flawor. It versatile and allow several thighs like compresing old logs, checking for size, history lengh and several other features. If needink help about logrotate, just let it now here.

Greeting David Ferreira,

Por jesusin, a ver cuando vuelvo a saber de tu vida ?que tal te va?


------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438&op=click _______________________________________________ Qmail-scanner-general mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general

Reply via email to