How to disable/enable all wordpress plugin via mysql/shell command lines

In order to view active plugins run:

mysql
use database;
SELECT * FROM wp_options WHERE option_name = "active_plugins";

From shell command line

mysql --host=localhost --user=database_user --password=dbpassword database -e 'SELECT * FROM wp_options WHERE option_name = "active_plugins";'

Save active plugins to file

mysql --host=localhost --user=database_user --password=dbpassword database -e 'SELECT * FROM wp_options WHERE option_name = "active_plugins";' |grep active_plugins |awk '{print $3}' > active_plugins.txt
Read the rest

How to move a running process to a screen

We need additional software to do this

We have to choose between reptyr and retty. As retty works for x86 linux system only, so we are going to use reptyr

Go ahead and install it:

$sudo apt-get install reptyr -y

For Centos you can get it here:

wget https://github.com/nelhage/reptyrRead the rest

How to dealing with jobs

If you have started a huge process and just remember that you've forget do it in screen session, you may try to move this process to the background. You can do this by pressing ctrl+z keys, which will temporary block this process and then run bg, here is example:

We've run maldet command

$maldet -a ./Read the rest

How to switch PHP handler from SuPHP to FastCGI

Firstly check the current configuration

/usr/local/cpanel/bin/rebuild_phpconf --current

Output:

Available handlers: suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: none
PHP5 SAPI: suphp
SUEXEC: enabled
RUID2: not installed

Enable if needed FastCGI by running

/scripts/easyapache

Here is syntax of rebuild_phpconf command

Usage: /usr/local/cpanel/bin/rebuild_phpconf [--dryrun] [--no-restart] [--no-htaccess] [--current|--available] [--errors] <Default PHP> <PHP4 Handler> <PHP5 Handler> <Suexec>

Here is how should look your command

/usr/local/cpanel/bin/rebuild_phpconf 5 none fcgi 1

where,

5 – default php version
none – means you don't need php 4 version
fcgi – php handler
1 – suexec is enable (change to 0 for disabling)

Done, enjoy!… Read the rest

How to disable eximstats via command line

Firsly check if running

/usr/local/cpanel/bin/tailwatchd --status

Output:
  Driver (Active: 0) Cpanel::TailWatch::JailManager
  Driver (Active: 1) Cpanel::TailWatch::ChkServd
  Driver (Active: 1) Cpanel::TailWatch::Eximstats
  Driver (Active: 0) Cpanel::TailWatch::Antirelayd
  Driver (Active: 1) Cpanel::TailWatch::cPBandwd

Disable eximstats by running:

/usr/local/cpanel/bin/tailwatchd --disable=Cpanel::TailWatch::Eximstats

Done!

You may then decrease size of eximstats database if needed
Enter eximstats database directly

mysql eximstats
and delete data from the following tables:

delete from sends;
delete from smtp;
delete from failures;
delete from defers;

Done, Enjoy!… Read the rest

How do I edit GRUB menu in Xubuntu

First you need to identify number of OS that needs to be loaded

cat /boot/grub/grub.cfg |grep class |grep '(' |grep -n menuentry

1:menuentry 'Ubuntu, with Linux 3.2.0-63-generic-pae (recovery mode)' –class ubuntu –class gnu-linux –class gnu –class os {
2:menuentry 'Ubuntu, with Linux 3.2.0-63-generic (recovery mode)' –class ubuntu –class gnu-linux –class gnu –class os {
3:menuentry 'Ubuntu, with Linux 3.2.0-61-generic-pae (recovery mode)' –class ubuntu –class gnu-linux –class gnu –class os {
4:menuentry 'Ubuntu, with Linux 3.2.0-61-generic (recovery mode)' –class ubuntu –class gnu-linux –class gnu –class os {
5:menuentry 'Ubuntu, with Linux 3.2.0-58-generic (recovery mode)' –class ubuntu –class gnu-linux –class gnu –class os {
6:menuentry "Ubuntu, with Linux 2.6.32-51-generic (on /dev/sda1)" –class gnu-linux –class gnu –class os {
7:menuentry "Ubuntu, with Linux 2.6.32-51-generic (recovery mode) (on /dev/sda1)" –class gnu-linux –class gnu –class os {
8:menuentry "Ubuntu, with Linux 2.6.32-28-generic (on /dev/sda1)" –class gnu-linux –class gnu –class os {
9:menuentry "Ubuntu, with Linux 2.6.32-28-generic (recovery mode) (on /dev/sda1)" –class gnu-linux –class gnu –class os {


Please note that calculation in grub starts from the zero, so for example number of

7:menuentry "Ubuntu, with Linux 2.6.32-51-generic (recovery mode) (on /dev/sda1)" –class gnu-linux –class gnu –class os {

is 6

Update the line GRUB_DEFAULT=0 into the followin file

sudo vi /etc/default/grub

from
GRUB_DEFAULT=0
to
GRUB_DEFAULT=999

where 999 is number of partition that needs to be loaded first

Update your grub.cfgRead the rest

How To Add A New User In Ubuntu Using The Command Line

Add new user using the following command

sudo adduser newusername

Enter password for this username and fill fields if you wish

Confirm the information is correct and enter "y"

You have user added with very basic privileges.

You now need to set a user up with sudo access previlegies

We need to edit  /etc/sudoers file as sudo

sudo visudo

Add new line under the following

root ALL=(ALL:ALL) ALL
newusername ALL=(ALL:ALL) ALL

Ctrl + x to save this file

Delete .tmp… Read the rest