Skip to Content

admin's blog

Preserve Log File Descriptor

Have you ever tried to clear a log file by removing the file, then touching a new one only to find your daemon does not write to the new file? So you restart the daemon and it still doesn't work? If you do this, chances are you will have to restart syslogd so it can find the new file descriptor you created when you touched the log.

If you are debugging and want a clear log, a better solution is write empty space to the file like this:

# echo "" > /opt/zimbra/log/zmmailboxd.out

This will empty the file and preserve the file descriptor.

Display Contents of Zimbra memcache

The contents of Zimbra's memcached cache can be displayed on a per account basis. Use zmproxypurge.

zmproxypurge -i -a

As of Zimbra 5.0.9, memcache stores routing information for IMAP and POP, not HTTP. See zmproxypurge -help for more memcached information.

Replace Newline Characters With Commas Using tr, Not sed

I recently had a 5.0.9 Zimbra mailbox with inconsistencies between metadata (MySQL DB) and blob store (/opt/zimbra/store/...) in which the store was missing blob data referenced in the database.

Once I parsed the zmblobchk report data to retrieve information for the mailbox I wanted to fix, I wanted an efficient way to remove the blob item references from the database.

All commands run as zimbra user.

A snip from zmblobchk's mb8blobcheck.rpt file:

* MailboxGroup=8, mailbox=8, item=397: file not found: 397-2020.msg (delete associated metadata)

Base64 Decode String

Base64 decode string with Perl on the command line.

perl -MMIME::Base64 -ne 'print
> decode_base64("PGRpdj4tLTxicj5UaGVzZSBIVE1MHNpZ25hdHVyZXMgYXJlIGdyZWF0Ljxicj48L2Rpdj4=")'

Zimbra stores mail signatures base64 encoded in the directory as objectClass zimbraSignature.

If you just need something quick, will do it for you.

Bypass Host Resolution Issues For Inbound Mail

Posted in

Zimbra uses the LMTP protocol for inbound mailstore delivery. By default, Zimbra's Postfix MTA will use DNS for mailbox server host resolution. Use this tip to bypass DNS inbound delivery from the MTA to mailstore.

$ su - zimbra

Query the existing Postfix value
$ postconf lmtp_host_lookup
lmtp_host_lookup = dns

Edit /etc/hosts

$ postconf -e lmtp_host_lookup=native

Update Zimbra's local configuration for upgrade persistence

Return-Path Header For Mail Coming From PHP's mail() Function

Posted in

By default, mail sent using the PHP mail() function will contain an envelope sender address consisting of the server's fully qualified domain name (FQDN). This can cause mail originating from apps like Drupal or MediaWiki that use PHP mail() for notifications to be filtered by mail servers rejecting sender domains not having an MX record.

Zimbra environment variable usage

Posted in

Release 5.0.9_GA_2533.UBUNTU6 UBUNTU6 NETWORK edition

You are becoming a more esteemed Zimbra admin, but are tired of manually fetching environment variables from zmlocalconfig. Simply put the values into your shell environment.

su - zimbra
source ~/bin/zmshutil

Now you can run your ldapsearch command like this:
ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password "(cn=*)"

The date command

Posted in

All values in "seconds" is the number of seconds from Epoch, Jan 1, 1970.

  1. Current time in seconds.
    date +%s
  2. Convert 1220815239 seconds to a human readable date.
    date -d @1220815239
    Sun Sep 7 15:20:39 EDT 2008
  3. Convert 1220815239687 milliseconds to a human readable date.
    date -d @$[1220815239687/1000]
    Sun Sep 7 15:20:39 EDT 2008

Increase Open File Limit On Red Hat

Posted in

At times, it is necessary to increase the number of open files for a particular service user. For example, if you see this in your MySQL .err log:

080723 2:41:04 [ERROR] Error in accept: Too many open files

To fix, increase the number of open files for your mysqld user. Mine is mysql.

Check the system's maximum open file limit

# cat /proc/sys/fs/file-max

If this value is too low, increase it

# echo 81920 > /proc/sys/fs/file-max

Now, edit /etc/security/limits.conf to increase limits for the mysql user

Recipes for tcpdump

Posted in

tcpdump is a great tool for protocol traffic analysis and troubleshooting. I'm sure by now you know you need it, but you just need to know how to effectively use it. This post will be updated ongoing.

Have a look here You'll find some great tips on tcpdump and other things nix.

  1. man tcpdump
  2. tcpdump -AvvvSs 1500 -i eth0 host
Syndicate content