SFTP to remote system using Virtual-IP

SFTP programmatically without interruption to a remote-system that uses Virtual-IP (physical box is subjected to change) with the following options.

sftp -o PasswordAuthentication=no -o StrictHostKeyChecking=no

This will add the remote hostname to ~/.ssh/known_hosts file automatically without interruption.

Posted bySeshu Karthick at 1:44 PM 0 comments  

Grep text recursively in Unix

Using the pattern keyword:
grep pattern * */* */*/* 2>/dev/null

The simplistic approach using find is:
find /startdir -exec grep whatever {} dev/null \;

That's not necessarily very efficient. Using xargs can help
find . -name *.xml | xargs grep whatever

Posted bySeshu Karthick at 8:56 AM 0 comments  

Using Mod_JK as Apache-Tomcat connector

Apache runs securely on port 80. Tomcat runs securely on port 8080, which means that the default URL of your application will be something like http://mydomain.com:8080. With mod_jk, you can run Tomcat securely on it's normal port and have Apache forward requests to Tomcat. This will eliminate the 8080 from URL. Ref: Eapps User Guide to setup Tomcat

For instance: In Eapps hosting, these can be seen in the Custom Settings tab of the Website settings area, on the Site tab in your control panel.

JkMount /spring* ajp13
JkMount /* ajp13
This setting gets reflected in httpd.conf file.

Posted bySeshu Karthick at 11:51 AM 0 comments  

Enable Sync Option for T-Mobile Moto Razr

If you have a Motorola Razr phone from T-Mobile, you would have noticed that it lacks the sync option under Menu-Settings-Connection. Here is a hack I used to overcome the handicap.

Motorola RAZR V3 supports SyncML. However, T-Mobile apparently disabled that feature for their own versions of V3. Click here to get simple step-by-step guide in enabling it again. For guidance on how to do seem editing, refer to this page for instructions and screenshots.

Troubleshooting:
After connecting your Motorola phone to the PC, the P2Kman should be able to connect to it. If you do not have the correct driver installed, P2Kman can not detect the presence of your mobile phone. For Windows XP/Vista users, install the drivers from MotoX Forums to fix it.

Once the sync option is enabled on T-Mobile Moto Razr, you can use services like Zyb and GooSync to sync your mobile with various web services.

Posted bySeshu Karthick at 5:58 PM 0 comments  

Switching SE Linux ON/OFF

I had setup a CGI script on a linux box, and set all permissions right. Yet, I get a "403 Forbidden" page when I access the script via Apache web server. On digging, here is what I found...

Fedora Core 3 introduced the concept of security contexts as part of the Security Enhanced Linux (SELinux) definition. A Web page may have the right permissions, but the Apache httpd daemon won't be able to read it unless you assign it the correct security context or daemon access permissions. Context-related configuration errors will give "403 Forbidden" browser messages. Click here to learn how to setup the security context.

To avoid the hassle of setting up a security context, we can just turn OFF the SE Linux mode.
To view the mode: $ getenforce

To turn OFF the SE Linux mode
$ setenforce Permissive
$ vi /etc/sysconfig/selinux ; Set the property 'SELINUX' to disabled or permissive

To turn ON the SE Linux mode:
$ setenforce Enforcing
$ vi /etc/sysconfig/selinux ; Set the property 'SELINUX' to enforcing

Posted bySeshu Karthick at 12:05 PM  

Upcoming

Here is what I'm up to... Some of the technologies that I will begin to play with include:

  1. Groovy & Grails : This will help me to quickly build a prototype of what I wanted. Its very useful to test the waters before diving in.
  2. SOA : I'm looking at OSGI (implemented by Equinox) and Oracle's platform for OSGI. This knowledge is crucial in order to architect a Software system.
  3. Various Unit Test frameworks
  4. New features of Java 1.5, 1.6, 1.7 : Purely for the purpose of Coding
  5. Security aspects offered by Java & Enterprise Java
Look forward for posts revolving around the above topics soon...

UPDATE: The list of resources I am using to learn the above tech stuff are ...
The official Groovy Documentation beginning with 'Getting Started Guide'
A free ebook 'Getting started with Grails'

Posted bySeshu Karthick at 4:12 PM  

Bulk rename in Unix

To change .htm files to .html
$for file in *.htm ; do mv $file `echo $file | sed 's/\(.*\.\)htm/\1html/'` ; done

Posted bySeshu Karthick at 12:50 PM  

Large deletes in Unix

If there are too many files to be deleted at once, the 'rm -f' command does not work. It throws up an error that states "/bin/rm: Argument list too long". So, here is a solution...

$find -name '*.txt' -exec rm -f {} \;

Here we find each entry that matches the pattern *.txt, and execute the command rm -f on it.
Courtesy: Thanks to my team lead for this tip.

Posted bySeshu Karthick at 12:20 PM  

Crash the kernel

To crash the UNIX kernel, type the following on its command prompt...
$ echo c > /proc/sysrq-trigger

Posted bySeshu Karthick at 8:47 AM  

Start Unix processes on bootup

The chkconfig command can be used to activate and deactivate services, and configure a service to start during bootup.


$ chkconfig --list <service name>

To activate[deactivate] the service during bootup:

$ chkconfig --level 2345 <service name> on[off]

Posted bySeshu Karthick at 9:51 AM 0 comments