How to create port listener on Linux

Install nc if needed

yum install nc

Run listener on port 3000

nc -l 3000 &
nc -l -k 3000 &

where -k is –keep-open will keep connection opened and allows multiple connections in listen mode

Check on the server’s side:

netstat -tunap |grep :3000

Output:

tcp        0      0 0.0.0.0:3000                0.0.0.0:*                   LISTEN      82786/nc            

Check from local machine:

$ nmap -p 3000 SERVERS_IP_ADDRESS

Output:

Starting Nmap 7.01 ( https://nmap.org
Read the rest

How to change a website’s IP address via command line

Just run

/usr/local/cpanel/bin/setsiteip -u $user $ip

or using whmapi1

whmapi1 setsiteip ip=11.12.13.14 user=$user

to add IP onto the server

whmapi1 addips ips=11.12.13.14 netmask=255.255.255.248

to remove IP

whmapi1 delip ip=11.12.13.14

to check IP usage

whmapi1 get_shared_ip user=$user

to check server’s IP addresses

whmapi1 listips
Read the rest

WordPress how to disable default wp-cron.php behavior

By default WordPress runs its wp-cron.php too frequiently, so to change it:

Update wp-config.php with the following line:

define('DISABLE_WP_CRON', true);

Setup manual cron job for wp-cron.php

Enter user’s crontab

crontab -lu USERNAME

And append command to run cron every 12 hours

0 */12 * * * cd /home/USERNAME/public_html; php -q wp-cron.php
Read the rest

How to remove missed module

Probably you got error/warning The following module is missing from the file system, No such folder/file

To get list of installed modules

drush pm-list

Drupal 7 using Drush:

drush sql-query "DELETE from system where name = 'old_module1' AND type = 'module';"

Once done clear cache:

drush cc all

Drupal 8 using Drush:

drush sql-query "DELETE FROM key_value WHERE collection='system.schema'
Read the rest

How to fix RoundCube’s error: DATABASE ERROR: CONNECTION FAILED!

Mysql server and InnoDB engine must to be running!

Check mysql connection:

cat /usr/local/cpanel/base/3rdparty/roundcube/config/config.inc.php |grep mysql:
$config['db_dsnw'] = 'mysql://roundcube:lasMubMX08D3HKtr@unix(/var/lib/mysql/mysql.sock)/roundcube';
mysql -u roundcube -p
show tables;

All tables should be in place:

+---------------------+
| Tables_in_roundcube |
+---------------------+
| cache               |
| cache_index         |
| cache_messages      |
| cache_shared        |
| cache_thread        |
| contactgroupmembers |
| contactgroups       |
| contacts            |
| cp_schema_version   |
| dictionary          |
| identities          |
| searches            |
| session             |
| system              |
| users               |
+---------------------+
15 rows in set (0.00 sec)

Cpanel keeps roundcube backups here:

/var/cpanel/roundcube

Go ahead and drop broken database

mysqladmin drop roundcube

Rebuild roundcube using the following two commands:

rpm -e --nodeps cpanel-roundcubemail

/usr/local/cpanel/scripts/check_cpanel_rpms --fix

Database roundcube should be recreated automatically.
Read the rest