Clean space from mysql-bin logs

Today, I was found out one of customer server filled up with mysql-bin log and the server var space fully utilized.

From their MySQL path, file as below have filled up,

As mysql-bin used to record the event of the MySQL databases and it is not necessary to keep the log from the first day of the databases create until the present date, hence I would suggest for maximum 30 days of logs to be kept.

To disable the mysql-bin, simply remove log-bin from the MySQL configuration file, /etc/.my.cnf or my.ini.
log-bin = mysql-bin

Otherwise, keep only 30 days of log,
expire_logs_days = 30

tailwatchd failed: A restart was attempted automagically

If you have cPanel with your server, you might get the following error.

tailwatchd failed @ Tue Jan 1 00:00:00 2010. A restart was attempted automagically
Service Check Method: [check command] tailwatchd is not running

However, you do not need to worry on it as it might be cPanel services stopped or restarted.

To understand in detail, you may execute the command as below from your Shell.
tail -f /usr/local/cpanel/logs/tailwatchd_log

To fix it, you may try to execute the command as below.
/usr/local/cpanel/libexec/tailwatchd –status

Then restart the cPanel services.
service cpanel restart

If the issue still not fix, may update cPanel,
/scripts/upcp –force

Debugging Perl/CGI Scripts

By default, Perl/CGI script will send the error to STDERR where it is the server standard error and normally it will store to the server Apache error log.

To setup private error_log from your Perl/CGI script, you may easily get them done with script below.

use CGI::Carp qw(carpout);
open(LOG, “>>/home/”) or
die(“Unable to open cgi-error.log: $!n”);

The carpout() used to call the error and send it to the log file that you set.

To setup error to send to browser,

use CGI::Carp qw(fatalsToBrowser);
die “Couldn’t open log file”;

Use the above script and it could send all the error to the Browser.