Tuesday, November 30, 2010

tomcat on vps

1 GB memory is needed to smoothly run an app on Tomcat.

/var/tomcat/bin# ./shutdown.sh
Using CATALINA_BASE:   /var/tomcat
Using CATALINA_HOME:   /var/tomcat
Using CATALINA_TMPDIR: /var/tomcat/temp
Using JRE_HOME:        /usr/java/jdk1.6.0_21/jre
Using CLASSPATH:       /var/tomcat/bin/bootstrap.jar
Error occurred during initialization of VM
Could not reserve enough space for code cache

http://stackoverflow.com/questions/286007/how-to-tune-tomcat-5-5-jvm-memory-settings-without-using-the-configuration-progra

$CATALINA_HOME/bin/export JAVA_OPTS="-XX:MaxPermSize=64m -Xms16M -Xmx64m"


Saturday, October 9, 2010

find ANT_HOME on ubuntu

Similar to JAVA_HOME, ant home can be found:



/usr/share/ant is my ANT_HOME
In case of using Ivy, ivy.jar can copied into /usr/bin/share/ant/lib

set JAVA_HOME for ant on ubuntu

To file java home(where jre/jdk) is installed on ubuntu:


 Then you add to
/etc/environment
the following line
JAVA_HOME="usr/lib/jvm/java-6-sun/jre"


ant JAVA_HOME is not defined correctly:






now Ant finds the java home

Thursday, October 7, 2010

Find that process running at a port and kill it

In Windows (7), You can list all the processes and the port it is running at by:
netstat -ano

To kill a process, replace pid with process id from previous step

taskkill /pid 5844  /F


In Ubuntu, You can find the process running at a port using grep

netsat -ano --program |grep 8080

and
kill porcessNumber

eg.



11814 is process running at port 8080.

Friday, September 24, 2010

how to find router ip address for any router of any OS

type tracert google.com from commandline

For example as in Ubuntu:

The first IP address is your computer's IP. 10.1.1.1 is the router's IP

Saturday, September 18, 2010

/etc/hosts file format

The format of /etc/hosts is:

How to find out the format?
type man 5 hosts in terminal

why 5?
5 is the section number of a man page, it means file formats
ref:http://en.wikipedia.org/wiki/Man_page



Extra:

The etc/hosts file specifies the hostname or computer name your current shell is running.
In my case, my computer name is zhang-laptop and my login name is zhang, so my bash looks like:

zhang@zhang-laptop:~$

And my etc/host file is:
zhang@zhang-laptop:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 zhang-laptop
    #added
    #127.0.0.2    domainhound
    #127.0.0.2    zhangmichael.com

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

how do you file the hosts file format?


Ref:
http://www.freebsd.org/doc/handbook/configtuning-configfiles.html
http://www.freebsd.org/cgi/man.cgi?query=hosts&sektion=5

Friday, August 13, 2010

/etc/alternatives/-->Debian alternatives system

Where is location of java on ubuntu?
Finding out the answer is not just use "whereis java" or "which java":

The alternatives directory lead to the alternative concept. when you type java, it could refer to a different real java location if a new version has just installed.
Eg. I was using java 5, typing java would start JVM 5; after installing java 6, type java would start JVM6.

Intuitively, I think having this extra level of indirection is useless...