September 2012
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930

Categories

September 2012
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930

Truncate a File to Zero byte in Linux

Sometimes you need to truncate/empty a file to zero byte length. For example, you have a big file that contains various logs and the size is too big to open it easily. Of course, you can remove this file and touch it again. But this way you will have to play with permissions and file […]

Log Rotation Apache

I have installed apache 2.2 on RHEL 5.7. It is working over ssl connection. I want to use rotatelog feature provided by apache. My httpd.conf file for specifying logs location is as below :

ErrorLog “|/apps/apache/bin/rotatelogs /mnt/nfs4/logs/apache/error_log.%Y-%m-%d 10M” <IfModule log_config_module> LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”” combined LogFormat “%h %l %u […]

Remove comments and blank lines from configuration files using grep

grep -v ‘^#’ /etc/httpd/conf/httpd.conf | grep -v ‘^$’

Redirect to the file

grep -v ‘^#’ /etc/httpd/conf/httpd.conf | grep -v ‘^$’ > test