Tuesday, February 15, 2011

Production Server/Mailserver Maintanace.

At first, allocate enough space for log partition. Linux system having default log rotation if you want to change you can do customize log rotation automatically.







See here maillog in GB, if no need just clear old log.
Log rotate.

drwxr-xr-x 2 root  root  4.0K Dec  8  2009 mail
-rw------- 1 root  root  504M Feb 15 00:49 maillog
-rw------- 1 root  root  1.1G Feb 10 02:37 maillog.1
-rw------- 1 root  root  469M Jan 31 22:23 maillog.2
-rw------- 1 root  root  1.9G Jan 30 04:17 maillog.3
-rw------- 1 root  root  1.9G Jan 23 04:17 maillog.4

Some of log rotating example:
Create the script name of /usr/bin/rotateapplog:
vi /usr/bin/rotateapplog

#! /bin/bash

TIMESTAMP=$(date +%Y-%m-%d)
cd /home/app/

cp log/production.log log/production.$TIMESTAMP.log

echo "$TIMESTAMP" > log/production.log

echo "done"

Add script as cron:

1 00 * * * /usr/bin/rotateapplog
--------------------------------------------------------------------------------------