Cpanel whmapi1 tool notes

Check bandwidth for a user:

whmapi1 showbw searchtype=user search=USERNAME year 2018 month 8

Change account's master domain:

whmapi1 modifyacct user=USERNAME domain=NEWDOMAINNAME

Change username:

whmapi1 modifyacct user=USERNAME newuser=NEWUSERNAME

Change package:

whmapi1 changepackage user=USERNAME pkg=NEWPKG

Show account's info:

whmapi1 accountsummary user USERNAME

Enable shell access:

whmapi1 modifyacct user=USERNAME HASSHELL=1
read -p "Username: " u; whmapi1 modifyacct user=$u HASSHELL=1

Update hostname:

whmapi1 sethostname hostname=HOSTNAME

Generate self signed SSL certificate:

whmapi1 generatessl domains=example.com
Read the rest

How to calculate IMAP/POP3 dovecot bandwidth

How to calculate IMAP dovecot bandwidth:

less /var/log/maillog |grep Aug |grep DOMAIN.COM |grep -Po 'out\=.+?,' |cut -d '=' -f2 |tr -d ,|awk '{s+=$1} END {print "total: ", s, " bytes transferred over IMAP"}'

total:  83107245783  bytes transferred over IMAP

echo "83107245783/1024/1024" |bc
79257M
~80G


How to calculate POP3 dovecot bandwidth:

less /var/log/maillog |grep DOMAIN.COM
Read the rest

How to fix innodb_table_stats and innodb_index_stats has length mismatch

To fix annoying warnings like:

[Warning] InnoDB: Table mysql/innodb_table_stats has length mismatch in the column name table_name.  Please run mysql_upgrade
 [Warning] InnoDB: Table mysql/innodb_index_stats has length mismatch in the column name table_name.  Please run mysql_upgrade

Just go ahead and run mysql_upgrade.… Read the rest

Centos 7 systemd increase MySQL open_files_limit

MySQL Warning like: Could not increase number of max_open_files to more than 65536

cat /etc/my.cnf |grep open_files_limit
open_files_limit=73461

But MySQL still shows 65536
MariaDB [(none)]>  SHOW VARIABLES LIKE 'open_files_limit';
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| open_files_limit | 65536 |
+------------------+--------+
1 row in set (0.00 sec)

Try to update next files:

/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.confRead the rest

How to tune/calculate table_open_cache, open_files_limit, table_definition_cache, table_open_cache_instances

Check current value of open_tables and opened_tables

Run:

show global status  like 'open%';

Output:

MariaDB [(none)]> show global status  like 'open%';
+--------------------------+----------+
| Variable_name            | Value    |
+--------------------------+----------+
| Open_files               | 2258     |
| Open_streams             | 0        |
| Open_table_definitions   | 1888     |
| Open_tables              | 2000     |
| Opened_files             | 10504934 |
| Opened_plugin_libraries  | 28       |
| Opened_table_definitions | 488898   |
| Opened_tables            | 542079   |
| Opened_views             | 18497    |
+--------------------------+----------+

Find out Table cache hit rate

Run:

show global variables like 'table_open_cache';

Output:

MariaDB [(none)]> show global variables like 'table_open_cache';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| table_open_cache | 2000  |
+------------------+-------+
1 row in set (0.00 sec)

Calculating:

Table cache hit rate = table_open_cache*100/Opened_tables

2000×100÷542079=0.37%

In general it should be more than 50%

Find out total tables of your databases

Run:

SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
Read the rest

Joomla 3.8.11 default index.php file

Short command:

curl -s https://alltime.pp.ua/downloads/j3-8-11index.txt > index.php

Copy/paste:

<?php
/**
* @package    Joomla.Site
*
* @copyright  Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license    GNU General Public License version 2 or later; see LICENSE.txt
*/

/**
* Define the application's minimum supported PHP version as a constant so it can be referenced within the application.
Read the rest

How to recover Joomla 3+

Ensure you have backed up your current website's version files/database

Tested on Joomla 3+ and can be helpful if system files are broken:

Find needed version and download it from https://downloads.joomla.org/latest
 

cd ~/public_html/
mkdir temp; cd $_
wget https://downloads.joomla.org/cms/joomla3/3-8-11/Joomla_3-8-11-Stable-Full_Package.zip
cd -
rsync -avz temp/* ./
Read the rest

WordPress default index.php file

Short command:

curl -s https://alltime.pp.ua/downloads/wpindex.txt > index.php

##

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
Read the rest