August 2014
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

August 2014
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Logoff user remote session using CMD

 

Using CMD to kick user not properly logoff in remote session. This command to list out the user. Have 2 command :

1 – quser /SERVER : [server name]

2 – qwinsta /SERVER : [server name] This command to kick the user :

1 – logoff /SERVER : [server name] [session id] Example :

[…]

Zimbra Creating self-signed certifiate UCSC Zimbra

Zimbra Creating self-signed certifiate UCSC Zimbra ===========

Backup Existing Commertical Certs ———————————

# cd /opt/zimbra/ssl/zimbra/commercial/ # mkdir -p DigiCert_old # cp commercial* ./DigiCert_old

# cd /opt/zimbra/ssl/zimbra/server # mkdir -p Server_old # cp server.* Server_old

# cd /opt/zimbra/bin Creating a CA ————-

# ./zmcertmgr createca -new ** Creating /opt/zimbra/ssl/zimbra/ca/zmssl.cnf…done ** Creating CA private key /opt/zimbra/ssl/zimbra/ca/ca.key…done. ** […]

shell samples

awk examples

cat 03092608.LOG|grep XYZ|awk -F”.” ‘{print $2}’ |sort|awk ‘{tot += 1 } $1 != prev {print prev,tot;tot=0;prev=$1}END{print prev,tot;tot=0;prev=$1}’

adhocs

1. find_processes_using_ipcs.ksh

 

ipcs -bop|grep `whoami`|awk ‘{print $10}’|egrep -v “^0|^$”|sort -u|awk ‘{print “ps -ef|grep “, $1}’|ksh

2. iostat iostat -xn 4 30 3. jmap jmap -heap:format=b <pid> 4. monitorMemLeaking if [ $# […]

Get the java info perl

#!/usr/bin/perl # Fast script to grab jstack / jinfo and jmap of processes running on server. # ### Update paths here for java_base. $java_base=’/usr/java/bin’; $jstack=’jstack’; $jinfo=’jinfo’; $jmap=’jmap’; $script=$0; $runuser=`/usr/xpg4/bin/id -nu`; chomp($runuser); #$outdir=’/tmp’; ($min, $hour, $day, $month, $year) = (localtime)[1,2,3,4,5]; $year=$year+1900; if ( $month < 10 ) { $month=”0$month”; } if ( $day < 10 ) […]

top_thread of Java

# put your JAVA_HOME here, JAVA_HOME=/opt/javavm PID=$1 IFS=” top_number=10 if[ $# -gt 1 ] ; then top_number=$2 fi top_number=$((top_number+1)) java_stack=`$JAVA_HOME/bin/jstack $PID` top=`top -s -b -H -p $PID -n 1 | grep -vE ‘^top|^Tasks|^Cpu|^Mem|^Swap|^$’ | awk ‘NR==1; NR > 1 {print $0 | “sort -nrk 9”}’ | head -$top_number` echo $top echo $top |while read […]

GET PROCESS THREAD

#!/bin/bash if[ $# -lt 1 ] ; then echo “Usage: “ echo ” threads_per_process.sh PID | process name [count] “ echo “” echo “Example” echo ” PID: 36434 or” echo ” process string: NumThreads (this script will do a ps -ef|grep NumThreads to get the PID)” echo ” The last number is the number […]

bash analyze ports and pids

# put your JAVA_HOME here, JAVA_HOME=/opt/javavm PID=$1 IFS=” top_number=10 if[ $# -gt 1 ] ; then top_number=$2 fi top_number=$((top_number+1)) java_stack=`$JAVA_HOME/bin/jstack $PID` top=`top -s -b -H -p $PID -n 1 | grep -vE ‘^top|^Tasks|^Cpu|^Mem|^Swap|^$’ | awk ‘NR==1; NR > 1 {print $0 | “sort -nrk 9”}’ | head -$top_number` echo $top echo $top |while read […]

Linux common SHELL

Linux common SHELL 1 delete 0 byte file find -type f -size 0 -exec rm -rf {} \; 2. view the process Arranged in descending memory ps -e -o “% C:% p:% z:% a” | sort -k5 -nr Press the cpu utilization in descending order ps -e -o “% C:% p:% z:% a” | sort […]

Perl Programming ( perl 5 )

Basics

Scripts

Perl is a script language, which is compiled each time before running. That unix knows that it is a perl script there must be the following header at the topline of every perl script: #!/usr/bin/perl where the path to perl has to be correct and the line must not exeed 32 charachters. Comments […]

Ksh Scripting

Principle of Script

Defining the Shell Type

To make a ksh script (which is a ksh program) crate a new file with a starting line like: #!/usr/bin/ksh It is important that the path to the ksh is propper and that the line doesn not have more than 32 characters. The shell from which you are […]