Linux

Tools of the trade : Postfix Configuration

Good link with information on configuring a custom transport link in Postfix. A transport link in a SMTP server is a way to define a communiction/delivery channel with particular settings. Example, you want all e-mails for a particular domain to be sent to a particular server at a particular time.

http://linuxnet.ca/postfix/dedicated_transport.html

In this particular link, the author shows the steps to configure a transport link for sending e-mails to servers/domains with high latency.

Loose the shackles..

If you need to edit documents, create spreadsheets and presentations… and don’t want to spend $$$ for Microsoft Office, download the latest version of OpenOffice for free and give it a try. You might be pleasantly surprised.

I wrote a post earlier about using OpenOffice as a free PDF Editor.. And that is just the tip of the iceberg of what you can do with OpenOffice.

Most of the people that use Microsoft Office, only use the basic functionality. As my old boss used to say, “95% of the people use 5% of the functionality in Office”. And switching to OpenOffice would be a breeze for then. OpenOffice is available for Microsoft Windows, Linux and Apple Mac OS X.

Since OpenOffice 3.0 was released back in October, the software has been downloaded more than 10 million times. And we are close to hitting 20 million downloads..Here’s a live counter from the OpenOffice website

HOWTO : Use find and grep together

If you ever wanted to search for a particular text in certain types of files in Linux, you can use the following combo of find and grep

find / -name \*.xml -type f | xargs grep -i “text_to_search”

I used *.xml (note the \ before *) as the mask in the filename to look for all XML files.. then I piped this to grep using xargs.

A colleague pointed out that I can do the same by using

grep -r o-i “text_to_speech”

HOW TO : Configure JBoss to follow symbolic links

Jboss, in addition to being an application server also serves static content. We recently ran into an issue where some static content was not displayed when users hit the link. The JBoss server kept spewing 404 errors, stating that the content was not found. On some hair pulling research, we figured out that JBoss, like Apache, does not follow/allow content mapped to a symbolic link.

So for example in your web app, you added a sym link to another directory, where most of your content is stored, Jboss would not show the content, when you go to the link.

Here’s a quick guide to fix this.

  1. Go to the deploy folder of the context you want to configure. For example, if you used the default context, you go to $JBOSS_HOME/server/default/deploy/jboss-web.deployer
  2. Edit the context.xml file and add allowLinking=”true” in the Context (NOTE : This allows Jboss to publish symbolic links on all apps in your application server, if you want to restrict it to just one particular app, you have to edit the context.xml in your specific application folder). Upon adding the option, our context.xml file looked as such



   

   
   org.jboss.web.tomcat.security.RunAsListener

More information on options for the context.xml can be found here

http://www.jboss.org/file-access/default/members/jbossweb/freezone/docs/2.1.0/config/context.html

For the record, Jboss configuration and accompanying documentation is what I call black magic :).. Too many options, too many ways to do the same thing.

Tools of the trade : Java application management

We recently launched a new product at work and had to optimize a Java web application hosted in a JBoss application server for performance. The following tools came in rather handy to troubleshoot and analyze the application.

  • Java core dump memory analyzer from SAP. This tool is better than the standard run of the mill heap analyzers since it can handle larger core dumps. The tool is available here.
  • Messadmin : Session information tool by Cedrik Lime. This tool helps you to analyze the sessions on the application server in real time. We were able to install it on the application server without making any changes in our application, other than adding a couple of listners.. In essence, we copied the jar/war files to the application server and edited our application web.xml file to add the following listners
<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>/WEB-INF/applicationContext*.xml,classpath:applicationContext*.xml</param-value>
</context-param>
<filter>
	<!-- MessAdmin Servlet Filter -->
	<filter-name>MessAdminFilter</filter-name>
	<filter-class>clime.messadmin.filter.MessAdminFilter</filter-class>
</filter>
	<filter-mapping>
	<filter-name>MessAdminFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
	<!-- MessAdmin listener -->
	<listener-class>clime.messadmin.core.MessAdminListener</listener-class>
</listener>

HOW TO : Repair corrupted MYSQL Table

I recently came across a corrupted table in MySQL and was getting the following error, when I was trying to access a table.

“mysql ERROR 145 (HY000): Table ‘xxxxxxx’ is marked as crashed and should be repaired”

I repaired the table by

  • Log into the mysql client using “mysql”
  • Change to the required database by using “use DATABASE_NAME”
  • Repair the table by using “repair table TABLE_NAME”

Love the simplicity of MySQL :).