Running Transaction Test… Killed

If you come across ‘yum’ suddenly dying during an operation with this message, this is likely the linux OOM killer doing it’s job. The problem at hand is that the machine you’re working on has very limited RAM, or SWAP is disabled. When the machine is nearing RAM capacity the OOM killer takes care of taking down the offender.

I first came across this working with a machine in ‘rescue’ mode, which has SWAP disabled by default. Enabling it took care of the problem.

If you run ‘dmesg’, you’ll be able to see something like the following:
Out of memory: Killed process XXXX, UID 0 (yum).

Convert Epoch to date in log files

Ever had to go through a log file only to find timestamps are in epoch(unix) style format? Here’s a one liner that will convert them for you to review, without modifying the actual file:

cat mylogfile | perl -ne 'if (/(\d{10})/){ my $epoch= $1; $date=scalar(localtime($epoch)); s/$epoch/$date/g; print; } else { print; }'

It goes through all the input lines, finds a pattern of ten digits next to each other, and converts that to a date. The output could be much more nicer than this, but the one liner would be longer too. I like it because of its simplicity.

Mutt – Delete messages by date

Often you’ll have the need to perform an action that applies to multiple messages within a mailbox, and possibly multiple mailboxes to perform it in as well. Mutt is a great tool altogether, and the perfect tool for this job. If you want to, say, delete all messages older than 8 days, from the command line this will do the trick:

#> mutt -f Maildir -e 'push D~d>8d\rq\n'

If you have to do it on multiple mailboxes, it’s just as easy to wrap the command up in a loop:

#> for i in `ls -1 */Maildir`; do mutt -f $i -e 'push D~d>8d\rq\n'; done

Of course be careful with that ‘*’, it can be dangerous ;) Lots of more information here:

http://www.mutt.org/doc/manual/manual-4.html

Unable to get webmail password

This error message shows when attempting to log in to Horde webmail in Plesk servers. The problem is a result of invalid permissions/ownership of the webmail credentials file. The solution is pretty simple, permissions of /etc/psa/.webmail.shadow need to be set in a very specific way:

Plesk 8.6.*:

# chmod 640 /etc/psa/.webmail.shadow
# chown root:apache /etc/psa/.webmail.shadow

Plesk 9.5.*:

# chmod 640 /etc/psa-webmail/horde/.horde.shadow
# chown root:apacheĀ  /etc/psa-webmail/horde/.horde.shadow/code>

Webmail access should be restored once the changes have been made.