Archive for the ‘cPanel’ Category
You are currently browsing the archives for the cPanel category.
You are currently browsing the archives for the cPanel category.
Some email user never remove their email message and they have never though that the older email actually wasting the hosting account space.
With this article, Mick Genie will guide you some shell script to remove email older than 3 months(90 days).
To run the shell script, you may make the shell script with .sh file as sample below.
Save the following coding name removed_mails_for_90days.sh
#!/bin/bash
IFS=”$”
cpanel_username=mickgenie //your cPanel username
domain=domain.com //your domain name
username=mickgenie //your email username (without domain)
cd /home/${cpanel_username}/mail/${domain}/${username}
find -P /home/${cpanel_username}/mail/${domain}/${username}/* -mindepth 1 -maxdepth 1 -mtime ‘+90′ | while read old; do
echo “Deleting ${old}…”
rm -rf “${old}”
done
Remember to change your cpanel_username, domain and username from the script.
Set the cronjob from your cPanel or shell access(SSH) which running daily.
0 0 * * * /bin/sh /home/mickgenie/scripts/removed_mails_for_90days.sh
By right, MySQL is one of the engine that used up lots of I/O and Memory resource from a server. Somehow you may use this scenario to setup so-called Clustering Web and MySQL server to reduce the I/O usage.
To setup remote MySQL server, you need 3 main steps as below.
1. Grant remote access to cPanel root user.
2. Add remote host information to /root/.my.cnf file.
3. Configure PHPMyAdmin configuration.
1. Grant remote access to cPanel root user,
To grant remote access to cPanel root user, you will need to amend the MySQL privilege as line below.
mysql> GRANT ALL PRIVILEGES ON *.* TO root@`192.168.1.1` IDENTIFIED BY ‘password’ WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO root@`mysql.mickgenie.com` IDENTIFIED BY ‘password’ WITH GRANT OPTION;
2. Add remote host information to /root/.my.cnf file,
Next, you will need to change the host of the MySQL location to the slave server.
[client]
user=”root”
pass=”password”
host=”mysql.mickgenie.com”
3. Configure PHPMyAdmin information,
Open file /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php, configure the setting as below.
$i++;
$cfg['Servers'][$i]['host'] = ‘mysql.mickgenie.com’;
$cfg['Servers'][$i]['port'] = ’3306′;
$cfg['Servers'][$i]['socket'] = ”;
$cfg['Servers'][$i]['connect_type'] = ‘tcp’;
$cfg['Servers'][$i]['extension'] = ‘mysql’;
$cfg['Servers'][$i]['compress'] = FALSE;
…
You have done the setting.
Sometimes, you may get the email quotas exceeded but your mailbox is actually not using so much spaces.
The mailbox user@mickgenie.com is full or very close to full.
You should remove some emails from the box as soon as possible to prevent
losing any future mail.
This mailbox is currently 100.00% (251.76/250.00 Megs) full.
There do have 2 methods to fix this issue.
1. You may go to the mail directories of your virtual account, look for the mailbox account and remove the maildirsize file.
2. If the above method not able to fix your problem, run the following command.
/scripts/generate_maildirsize –force username
Where the username is your cPanel username.
Today, I’m about to guide you how to install the SSL key and it will a bit tricky compare to generate the SSL CSR key.
To install the SSL key through Shell, refer to the step as below.
1. Go to path /usr/share/ssl/certs.
$ mickgenie@mickgenie.com[/]# cd /usr/share/ssl/certs
2. Check if the domain.com.csr and domain.com.cabundle existed, else create them and enter the code.
3. Go to path /usr/share/ssl/private.
$ mickgenie@mickgenie.com[/]# cd /usr/share/ssl/private
4. Use the CA key and create the domain.com.key and enter the code.
5. Backup your httpd.conf file and enter the following code before your virtualhost tag.
SSLEnable
SSLCertificateFile /usr/share/ssl/certs/domain.com.crt
SSLCertificateKeyFile /usr/share/ssl/private/domain.com.key
SSLCACertificateFile /usr/share/ssl/certs/domain.com.cabundle
SSLLogFile /usr/local/apache/domlogs/domain.com-ssl_data_log
SetEnvIf User-Agent “.*MSIE.*” nokeepalive ssl-unclean-shutdown
Note: If cabundle not exist then remove the whole line of cabundle(line4).
6. Restart the httpd services.