Skip to main content

Posts

Showing posts from November, 2012

Enabling GC Activity Logging Without Restarting the JVM

Enabling Garbage Collection (GC) activity logging normally requires a restart of the JVM hosting the service.
Below steps explains how GC logging can be enabled without requiring a JVM restart for a chosen service.
Assuming user1 is the owner of the running JVM process, and 10274 is the PID (Process ID) of the JVM you are targeting, you can get the GC logging info from it by using:
sudo -u user1 /usr/java/default/bin/jinfo -flag +PrintGC 10274 sudo -u user1 /usr/java/default/bin/jinfo -flag +PrintGCTimeStamps 10274 sudo -u user1 /usr/java/default/bin/jinfo -flag +PrintGCDetails 10274
Note: The output is stdout

Shell Script to add SSH automatic Login

Script to add SSH automatic Login

#!/usr/bin/ksh -f

RUSER=$1
RHOST=$2

        if [ -z "${RHOST}" ]
        then
                echo "\nUsage: $0 remoteUserName remoteHostName\n"

                exit 22
        fi

        if [ ! -f ${HOME}/.ssh/id_rsa.pub ]
        then
                echo "SSH not configured for user ${LOGNAME} - creating key..."
                ssh-keygen -trsa -N "" -f ~/.ssh/id_rsa
                STATUS=$?
                if [[ ${STATUS} -ne 0 ]]
                then
                        echo "SSH configuration FAILED for ${LOGNAME}"
                        exit ${STATUS}
                fi

                chmod 755 ${HOME}

        fi

        echo "SSH configured for ${LOGNAME} OK."
echo "Processing ${RUSER}..."

        scp ~/.ssh/id_rsa.pub ${RUSER}@${RHOST}:id_rsa.pub.hotfix

        STATUS=$?

        if [[ ${STATUS} -ne 0 ]]
        then
                echo "scp of public key file t…