Categories
cPanel linux

How to delete all mail in queue for cPanel exim

I ran into an issue where a user was spamming and queue up thousands of email in our cPanel server. To clear it out, I did this:

/etc/init.d/exim stop

exim -bpru | awk {'print $3'} | xargs exim -Mrm

or

exim -bpru|grep frozen|awk {'print $3'}|xargs exim -Mrm

/etc/init.d/exim start

I had about 120k emails in queue and it took about 20 seconds to remove them all. If you want to fine tune it, you can have exim delete only specific emails in queue:

grep -lr 'a certain string' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm

Credit to: http://bradthemad.org/tech/notes/exim_cheatsheet.php
 

To delete frozen emails from a specific email address:

exiqgrep -i -f luser@example.tld | xargs exim -Mrm

If you just want to delete mail queue directories, sometimes faster delete:

/var/spool/exim/input and the /var/spool/exim/msglog directories

Categories
cPanel linux

Fatal error: Allowed memory size of 134217728 bytes exhausted – MySQL error – PHPMyAdmin

I had a client trying to import a 200M zip file to phpmyadmin to import into his MySQL database, he kept receiving this error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 201380904 bytes) in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/zip_extension.lib.php on line 65

It ends up that phpmyadmin is using its own php.ini config, and defaults the memory size to 128M.

Edit the file : /usr/local/cpanel/3rdparty/etc/php.ini.dist

there is a line that says memory_limit, change that to what you’d like. I changed mine to 264M.

You will want to restart cPanel as well:

/etc/init.d/cpanel restart

You will lose this setting upon reboot, so if you want to keep it, you will want to run this:

echo "/usr/local/cpanel/3rdparty/etc/php.ini.dist" >> /etc/cpanelsync.exclude

This will exclude the file when it goes to sync/update with cPanel.

Categories
cPanel linux

Copying cPanel resller account to cPanel server with root access

So I was in the process of moving a users cPanel account from an old server where he only had Reseller access to, on to my server, where I have root access. Typically you can use the method of the built in transfer within cPanel, but it is required you have root access on both servers. Because of this, it makes reseller accounts tricky. We need to do the following :

On the old server, where you have the reseller, or shared account :

1. Login to accounts cpanel www.domain.com/cpanel (or http://10.10.10.10.:2082)

2. You will then search for backups and hit enter

3. Now click on back up wizard option

[zp src=”reseller.jpg” album=”blog/cpanel/transfers/” width=”600″]

You can select wherever you would like to store it, but I prefer to jut SCP it right over to my new server.

on the new server, where you have root access :

1. Login to your server via SSH using something like putty

2. cd /home

3. wget http://domain.com/backup-1.30.2007_06-36-16_durbidge

4. log in to WHM & /Backup Restore a Full Backup/cpmove file

Note that you do need to 0777 the back up file, or you will run into permission issues when copying (if doing the backup to HOME DIR).

If you want to re-assign the reseller account, you do need to go to the reseller central, and apply the accounts to the reseller that owns them now.