Posts

Showing posts from September, 2012

Shell Script to kill all java processes on different hosts

Shell Script to kill all java processes on different hosts. The scripts assumes auto login using shh is enabled. The steps are explained here #!/bin/bash #################################### # Set These Values to correspond to your environment #################################### BLHOSTS=(linhtr1 linhtr2 linhtr3 linhtr4); SH_CMD=ssh #################################### SCRIPT_HOME=`dirname $0` for host in ${BLHOSTS[@]}; do      echo $SH_CMD $host "ps -ef | grep java|cut -b10-15|xargs kill -9"      $SH_CMD $host "ps -ef | grep java|cut -b10-15|xargs kill -9" done

Unable to create new native threads resolution

In one of our new machines, we are trying to start our servers. For 4 Servers, the system was working properly, but with 8 Servers it was throwing below exception. [gsc][3/20922] Caused by: java.lang.OutOfMemoryError: unable to create new native thread 2012-09-19 20:06:24,217 GSA WARNING [com.gigaspaces.grid.gsa] - [gsc][3/20922]: Reported Error [Restart Regex [.*java.lang.OutOfMemoryError.*] matching [Caused by: java.lang.OutOfMemoryError: unable to create new native thread]], restarting [gsc][1/] /<path>//bin/gs.sh: line 92: 21421 Aborted (core dumped) "$JAVACMD" ${JAVA_OPTIONS} -DagentId=${AGENT_ID} -DgsaServiceID=${GSA_SERVICE_ID} $bootclasspath $script_classpath ${RMI_OPTIONS} $libpath ${LOOKUP_GROUPS_PROP} ${LOOKUP_LOCATORS_PROP} -Dcom.gs.logging.debug=false ${GS_LOGGING_CONFIG_FILE_PROP} $NETWORK $DEBUG $launchTarget $command_line # # There is insufficient memory for the Java Runtime Environment to continue. # Cannot create GC thread. Out of system reso

ssh Auto Login without prompt for password

Problem:  On 4 of my Linux boxes i want to run some scripts by running them on all of boxes. I Login to one machine and run the script to use all 4 machines to perform the task. We use SSH to run our tasks. Therefore we need an automatic login from host machine to other machines. We don't want to enter any passwords, because you want to call ssh from a within a shell script. Steps to Perform this: We have 4 machines named linhtr01, linhtr02, linhtr03, linhtr04. We have same user and password on all 4 machines. Lets Assume Host machine as linhtr01. 1. Login to Host machine linhtr01. 2. Generate a pair of authentication keys without entering a passphrase   user1@linhtr01:~> ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/user1/.ssh/id_rsa): Created directory '/home/user1/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/user1/.ss