Saturday, February 11, 2017

Find List of email ids belong to all domains exist in cpanel server

Unfortunately there is no built-in way in WHM/cPanel to list every POP3/IMAP account for every domain in one listing, however, using the command line and our built-in API system, you can run a query to list true email accounts:

1. as root change to /var/cpanel/users
# cd /var/cpanel/users

2. run the following one-line query against our API system:

# for file in *; do whmapi1 list_pops_for user=$file 2>/dev/null | grep \@ | grep -F @; done

This will result in an output such as:

root@server [/var/cpanel/users]# for file in *; do whmapi1 list_pops_for user=$file 2>/dev/null | grep \@ | grep -F @; done
- a@domain1.com
- x@domain1.com
- belle@domain2.com
- brian@domain3.com
- demos@domain3.com
- greypromo@domain3.com
- info@domain4.com
- kage@domain5.com
- news@domain6.com
- release@domain6.com
- sales@domain6.com

and so forth. These are all of the true email accounts on for every domain on your server.

Hope this information helps!

Friday, February 10, 2017

Tomcat/java



How to check java/tomcat version on cpanel 


+++
[root@ns1 /]# /etc/init.d/tomcat version

Server version: Apache Tomcat/7.0.65
Server built:   Jan 6 2016 18:50:03 UTC
Server number:  7.0.65.0
OS Name:        Linux
OS Version:     2.6.32-573.26.1.el6.x86_64
Architecture:   amd64
JVM Version:    1.7.0_101-mockbuild_2016_04_21_13_21-b00
JVM Vendor:     Oracle Corporation
++++


Below is the code for test.jsp   testing script when java/tomcat is enabled on server.


++++

    Test JSP page
   
       

Working JSP page!


        This is a page to verify that .jsp support has been enabled


       
           
               
               
           
           
               
               
           
           
               
               
           
           
               
               
           
       
Date:<%= new java.util.Date() %>
Remote Address:<%= request.getRemoteAddr() %>
Request Method:<%= request.getMethod() %>
Servlet Path:<%= request.getServletPath() %>

   

++++

htaccess code 


As the servlet mapping only works on port 8080 and doesn't work on the Apache mod_jk proxy on port 80, we have to add below two lines needed for these to work with Apache into the user's .htaccess file at /home/user/public_html location:


+++
SetHandler jakarta-servlet
SetEnv JK_WORKER_NAME ajp13
+++

Script to print tomcat version 


++++++++++++++
[root@ns1 public_html]# cat version.jsp

Server info: <%= application.getServerInfo() %>

Servlet version: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %>

JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %>

Java version: <%= System.getProperty("java.version") %>
++++++++

You can view this script using http://website/version.jsp

Check Inode usage

You can check Inode usage using below script.

echo "Detailed Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"

add googlebot in csf

How to allow googlebot in CSF



Add below entries in /etc/csf/csf.rignore

.googlebot.com
.crawl.yahoo.net
.search.msn.com
.search.msn.com
.configserver.co.uk
.configserver.com
.aws.amazon.com

save this file and restart csf service.