Category: Centos
How to work around “is not an EA4 SCL PHP” error
“ea-php72” is not an EA4 SCL PHP
Update both .bash_profile and .bashrc files under your home/ directory as following:
export PATH=/opt/alt/php72/usr/bin:$PATH alias ea-php72="/usr/local/bin/lsphp"
Use a real path to your PHP binary file if its not yours /usr/local/bin/lsphp
Run to apply updates:
source .bashrc… Read the rest
How to remove mailman archives on cPanel server
Find your mbox files
ls -la /usr/local/cpanel/3rdparty/mailman/archives/private/my1_lists.domain.com.mbox/my1_lists.domain.com.mbox ls -la /usr/local/cpanel/3rdparty/mailman/archives/private/my2_lists.domain.com.mbox/my2_lists.domain.com.mbox
Backup *.mbox files if needed and empty them:
truncate -s 0 /usr/local/cpanel/3rdparty/mailman/archives/private/my1_lists.domain.com.mbox/my1_lists.domain.com.mbox truncate -s 0 /usr/local/cpanel/3rdparty/mailman/archives/private/my2_lists.domain.com.mbox/my2_lists.domain.com.mbox
Go to bin/ folder and wipe as following:
cd /usr/local/cpanel/3rdparty/mailman/bin ./arch --wipe my1_lists.domain.com ./arch --wipe my2_lists.domain.com… Read the rest
How to create a file of specific size using Linux command line
Reduce size using truncate command
Run for a second:
yes "some text" > testfile.txt
Reduce size using truncate:
truncate -s 50M testfile.txt
Create 50M file using fallocate command
fallocate -l 52428800 testfile.txt
To be more exact using inline arithmetic:
fallocate -l $((50*1024*1024)) testfile.txt… Read the rest
Configure CSF on CentOS 7
Install needful packages if you haven’t yet
yum install wget vim perl-libwww-perl.noarch perl-Time-HiRes -y
Download and install CSF
cd /usr/src/ wget https://download.configserver.com/csf.tgz tar -xzf csf.tgz cd csf sh install.sh
Run test:
cd /usr/local/csf/bin/ perl csftest.pl
Disable default Centos 7 firewall if you have it installed
systemctl stop firewalld systemctl disable firewalld
Disable testing mode
cd /etc/csf/ vim csf.conf… Read the rest
How to change default SSH port
Open sshd config file
vi /etc/ssh/sshd_config
Find and uncomment then change 22 to wished port number
# Port 22
Restart SSH server
service sshd restart
How to grep without grep
Issue:
ps axufS |grep tailwatchd
Output:
root 3052360 0.0 0.0 114756 984 pts/6 S+ 00:45 0:00 | _ grep --color=auto tailwatchd
root 1916299 0.0 0.0 53500 10412 ? S 2018 1:59 tailwatchd
Long way:
ps auxfS |grep tailwatchd |grep -v grep… Read the rest
Output:
root 1184626 0.0 0.0 52160 11424 ?
How to create SQL dumps of all user’s MySQL databases
Enter username and wait while it creates MySQL dumps:
read -p "Username: "user && for i in `mysqlshow |grep $user |cut -d '|' -f2`; do mysqldump $i > $i.sql; done… Read the rest
How to create MySQL dump and get it on your email
Definitely could be a mail sending problem if your SQL dump too large
mysqldump -ce my_db --user=my_user --password=mypass |gzip > ~/DBBackup.`date +\%F`.gzip; uuencode ~/DBBackup.`date +\%F`.gzip DBBackup.`date +\%F`.gzip |mail -s "my DB" [email protected]; rm -f ~/DBBackup.`date +\%F`.gzip… Read the rest