Mickgenie.com's Linux Blog

Mick Genie Linux Blog
  • Home
  • About
16 Aug 2010

cPanel: How to monitor crond services using chkservd

When you are using cPanel cron services, you might found out the cPanel services down without any clue.

With this article, Mick Genie will guide you how to check your crond services by using cPanel chkservd services.

cPanel offer chkservd services to automatically monitor daemon services from the Linux server.

To done this, follow the step as below.
1. Open the file /etc/chkserv.d/crond, pico /etc/chkserv.d/crond
2. Add the command as below to the file.
service[crond]=x,x,x,/etc/init.d/crond restart,crond,root
3. Open the file /etc/chkserv.d/chkservd.conf, pico /etc/chkserv.d/chkservd.conf
4. Add command below to last line of the above file.
crond:1
5. Restart chkservd services, /scripts/restartsrv chkservd

  • Twitter
  • Facebook
  • Blogger Post
  • Delicious
  • WordPress
  • Share/Bookmark
16 August, 2010 at 8:00 by mickgenie

Tags: chkservd, Clue, cronjob, Daemon, File Service, Linux, Linux Server, monitor cron, monitor cronjob, pico, Scripts
Posted in cPanel | No Comments »

15 Aug 2010

cPanel MySQL database size show 0 MB

With WHM/cPanel 11.25, you might found out the MySQL database size show 0MB for all instead of the actual size of the database when you look from the MySQL section from cPanel.

To get this fix, you may easily change the cPanel config from SSH.

1. Log into the SSH.
2. modify the cpanel.config, pico /var/cpanel/cpanel.config.
3. Search for disk_usage_include_sqldbs=0.
4. Change to disk_usage_include_sqldbs=1.
5. Save it.
6. Compile the cPanel script, /scripts/update_db_cache.

Alternatively, log into the WHM, go to tweak setting and look for “When displaying disk usage in cpanel/WHM include Postgresql and MySQL.” and checked it.

  • Twitter
  • Facebook
  • Blogger Post
  • Delicious
  • WordPress
  • Share/Bookmark
15 August, 2010 at 8:00 by mickgenie

Tags: Actual Size, Config, cPanel, cPanel config, Database Size, Disk Usage, Mysql Database, MySQL space, pico, Postgresql, Scripts, SSH, Whm
Posted in Database | No Comments »

14 Aug 2010

Jailed Shell memory issue

If you are using Secure Shell (SSH), you might get these error when you running your php script.

PHP Fatal error:  Out of memory (allocated 20447232) (tried to allocate 4096 bytes) in email.php

If you are the programmer or system administrator, you might tried to increase the memory_limit from the php.ini or using ini_set to increase the memory_limit but you will find out no matter how much memory_limit you set will not solve the problem.

The reason of the error occurs is not because of the PHP memory_limit usage of your script, but it is because the jailed shell limitation.

With cPanel jailed shell, the problem could caused by the forkbomb setting of your cPanel limited the PHP memory.

You may easily get this fix by modify the file as detail below where you should change the user to the cPanel user of your account.
/home/virtfs/user/etc/profile.d/limits.sh

Search for,
if [ "$LIMITUSER" != "root" ]; then

Then modify the ulimit “-m 200000″ to “-m unlimited” and save it.

  • Twitter
  • Facebook
  • Blogger Post
  • Delicious
  • WordPress
  • Share/Bookmark
14 August, 2010 at 8:00 by mickgenie

Tags: Fatal Error, Increase Memory, Ini, Limited, Memory Issue, Memory Limit, Memory Usage, Php Script, Programmer, Script Php, Secure Shell, SSH, System Administrator, Ulimit
Posted in SSH, cPanel | No Comments »

10 Aug 2010

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.

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

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.

  • Twitter
  • Facebook
  • Blogger Post
  • Delicious
  • WordPress
  • Share/Bookmark
10 August, 2010 at 8:00 by mickgenie

Tags: apache error log, Browser, Carp, Cgi Perl, Cgi Script, Logs, Perl Cgi Scripts, Perl Script, Perl Scripts, Scripts Cgi, Scripts Perl, Server Apache, Setup Error, Standard Error
Posted in Perl | No Comments »

8 Aug 2010

Terminate cPanel account that suspended for more than 2 months

As a server administrator, you might want to follow-up which account has suspended for days and it’s the time for you to terminate it.

With a smart system administrator(lazy actually), you may have a custom script to check any of your account that been suspended for more than 2 months may terminate from the server automatically to save the resource/space from the server.

From this article, Mick Genie will guide you how to write a shell script and create it from the cronjob, however this step could only done by the root user.

1. Create a file name autoterminated_within60days.sh from /root/scripts/.
2. Insert the following code and save it.

for i in `find /var/cpanel/suspended/ -mtime +60 | cut -d’/’ -f5 | sed ‘1 d’`
do
y | /scripts/killacct $i;
done;

3. Create a cronjob, by typing crontab -e in SSH.
4. Type as following line in the crontab to apply daily checking.

0 0 * * * /bin/sh /root/scripts/autoterminated_within60days.sh

  • Twitter
  • Facebook
  • Blogger Post
  • Delicious
  • WordPress
  • Share/Bookmark
8 August, 2010 at 20:53 by mickgenie

Tags: cPanel, cpanel terminate account, cronjob, Crontab, Custom Script, Resource Space, Root User, Scripts, Server Administrator, Shell Script, System Administrator, terminate account, terminate suspended
Posted in cPanel | No Comments »

« Older Entries
  • RSS RSS

    • cPanel: How to monitor crond services using chkservd
    • cPanel MySQL database size show 0 MB
    • Jailed Shell memory issue
    • Debugging Perl/CGI Scripts
    • Terminate cPanel account that suspended for more than 2 months
    • Find and replace a word from a file
    • How to install Firefox 4.0 BETA by Ubuntu
    • Linux Portable Apps
    • Update Centos Linux 5.4 to Centos Linux 5.5
    • How to delete email older than 3 months from cPanel
  • [Google]
  • Categories

    • Apache
    • Application
    • Blogging
    • cPanel
    • Database
    • DNS
    • FTP
    • Google
    • Linux
    • New Hand
    • Perl
    • Php
    • RoR
    • SSH
    • Time Zone
    • ubuntu
    • Wordpress
  • Archives

  • Calendar

    September 2010
    M T W T F S S
    « Aug    
     12345
    6789101112
    13141516171819
    20212223242526
    27282930  
  • Blogroll

    • Mick Genie Blog
  • Meta

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Sponsored Links

  • cPanel Podcast

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
Mickgenie.com's Linux Blog is powered by WordPress
Theme Design by Generic Designer

Entries (RSS) and Comments (RSS)