Aug 23, 2012

How to add cron job by Chef

Thanks to Chef, I have could save my time. Because I'm responsible for over 70 servers. I installed Middleware, configured user and ssh and OS environment variables by Chef 4 months ago. It just took half a day. Thanks Chef!

As you know, the LOGs became monsters when we have been satisfied. My application dumped out 4.4GB monsters for 4 months. I need to hunt them. So I reused Chef!

Here is my Chef recipe.


Here is my shell hunts monsters.


After run Chef client, you can confirm cron job is activated.


If you want to configure detail level of cron, please look around the following URL.
http://wiki.opscode.com/display/chef/Resources#Resources-Cron

Aug 9, 2012

How to get thread dump in Tomcat


#ps -ef | grep tomcat
30012    32470     1  6 15:06 ?        00:02:29 /usr/local/java/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -server -Dcom.sun.management.jmxremote -XX:MaxPermSize=256m -XX:PermSize=256m -XX:SurvivorRatio=2 -Xmn2048m -Xmx4096m -Xms4096m -Dweblogic.corba.client.bidir=true -XX:+PrintGCDetails -Xloggc:/usr/local/tomcat/logs/gc.log.20120809-1506 -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start

#kill -3 32470

Thread dump would be recorded on /usr/local/tomcat/logs/catalina.out
Thread dump starts with "TP-Proccesor".

Aug 7, 2012

error: src refspec master does not match any. error: failed to push some refs to 'git@github.com:.git'

If you are a github newbie as like me, it will help you.
Here is what I got message from git after I made new repository.
error: src refspec master does not match any.
error: failed to push some refs to 'git@github ... .git'
I googled and found this solution. It works for me.

$ touch README
$ git add README
$ git add *
$ git commit -m 'my first commit'
$ git push origin master --force