Tag Archives: grep

Jul 15

  • Created: Jul 15, 2011 1:47 PM

Removing old Kernels on CentOS 4

Removing old kernels on CentOS 4

Kernels RPMs are install only packages but CentOS 4 has no limit on the number of install only packages it will keep around, so you can easily end up with years worth of kernels installed on your server. This doesn’t cause any harm but it can be annoying to have so many un-needed packages installed and they can take up space.

You can see all the kernels installed with the command below. The example below has 39 regular kernels and 39 SMP kernels installed. Read more

Posted in: CentOS / Tagged: , , , ,
May 9

  • Created: May 9, 2011 12:05 PM

Using qmail/qmqtool One Liners

qmail/qmqtool One Liners
Qmail is the mail client that comes with the control panel we use, Interworx. Qmail has its strengths and weaknesses, one drawback is there’s no easy built in way to view the messages in the mail queue. One of the ones tools that comes with Interworx ‘s qmail is qmqtool. I’ve found this tool very useful for working on mail queues and debugging problems and have developed a number of one liners to quickly diagnose problems.

<br />
# who are the top senders for the remote queue<br />
/var/qmail/bin/qmqtool -R | grep &quot;From: &quot; | sort  | uniq -c | sort -rn | head -20</p>
<p># who are the top recipients of the remote queue<br />
/var/qmail/bin/qmqtool -R | grep &quot;To: &quot; | sort  | uniq -c | sort -rn | head -20<br />
/var/qmail/bin/qmqtool -R | grep &quot;Envelope Recipient: &quot; | sort  | uniq -c | sort -rn | head -20</p>
<p># what are the top subjects of the remote queue<br />
/var/qmail/bin/qmqtool -R | grep &quot;Subject: &quot; | sort  | uniq -c | sort -rn | head -20</p>
<p># what domains are being sent the most mail from the server<br />
/var/qmail/bin/qmqtool -R | grep &quot;To: &quot; | cut -d @ -f2  | tr -d '&gt;' | sort | uniq -c | sort -rn | head -20<br />
/var/qmail/bin/qmqtool -R | grep &quot;Envelope Recipient: &quot; | cut -d @ -f2  | awk '{print $1}' | tr -d '&gt;' | sort | uniq -c | sort -rn | head -20</p>
<p># who are the top receivers for the local queue<br />
/var/qmail/bin/qmqtool -L | grep &quot;To: &quot; | sort  | uniq -c | sort -rn | head -20<br />
/var/qmail/bin/qmqtool -L | grep &quot;Envelope Recipient: &quot; | sort  | uniq -c | sort -rn | head -20</p>
<p># what domains are have the most mail in the local queue<br />
/var/qmail/bin/qmqtool -L | grep &quot;To: &quot; | cut -d @ -f2  | tr -d '&gt;' | sort | uniq -c | sort -rn | head -20<br />
/var/qmail/bin/qmqtool -L | grep &quot;Envelope Recipient: &quot; | cut -d @ -f2  | awk '{print $1}' | tr -d '&gt;' | sort | uniq -c | sort -rn | head -20<br />

Posted in: Linux / Tagged: , , ,