HOWTO : Clean up all log archives after a period of time

If I understand fully and correctly, logrotate just compress log files and the number of compressed log files will be growing up after a period of time. It will not delete those outdated compressed log files automatically.

Therefore, I write the following shell script for the captioned purpose which will delete all the files at /var/log and its subdirectories that are existing more than 30 days.

You can change the existing days by altering the value at DAYEXIST.

Step 1 :

nano /home/samiux/cleanup

————- CUT HERE —————–
#!/bin/bash

LOGDIR=”/var/log”
DAYEXIST=”30″

find $LOGDIR -type f -mtime +$DAYEXIST -exec rm {} \;

exit 0
————- CUT HERE —————–

sudo chmod +x /home/samiux/cleanup

Step 2 :

Perform the task at 0130 hours every day.

sudo crontab -e

30 1 * * * /home/samiux/cleanup 2 >&1

Step 3 :

WARNING : DO IT AT YOUR RISK

** Your comment is welcome when my concept is wrong, thanks **

Enjoy!

HOWTO : Passive mode for Pure-FTPd on Ubuntu Server 9.04

I used to use vsFTPd. However, I recently need to test ISPConfig 3 which requires to install Pure-FTPd. My testing server is behind NAT and FTP should be running in passive mode. How to do it on Pure-FTPd?

Assumed that your server IP is 192.168.50.100 and you want to specify a port range 50000-50100 for the passive mode.

Step 1 :

sudo nano /etc/pure-ftpd/conf/PassivePortRange
50000 50100

sudo nano /etc/pure-ftpd/conf/ForcePassiveIP
192.168.50.100

Step 2 :

Restart the service.

sudo /etc/init.d/pure-ftpd restart

That’s all!