while true; do n=`netstat -n|grep 2707|wc -l`; echo $`date` --- $n ; sleep 1; done;
Useful for load testing a service.
while true; do n=`netstat -n|grep 2707|wc -l`; echo $`date` --- $n ; sleep 1; done;
/* give worker threads a meaningful name such as "OIO-worker-2" */
try {
ThreadRenamingRunnable.setThreadNameDeterminer(
new ThreadNameDeterminer() {
public String determineThreadName(String currentThreadName,
String proposedThreadName) throws Exception {
StringBuffer sb = new StringBuffer(WORKER_THREADNAME_PREFIX);
sb.append(currentThreadName.substring(currentThreadName.lastIndexOf('-')));
return sb.toString();
}
});
} catch (Exception e) {
/* fall back to default thread name, e.g. pool-X-thread-X */
ThreadRenamingRunnable.setThreadNameDeterminer(ThreadNameDeterminer.CURRENT);
}
grep "Summary" *.log|awk '{sum += $7} {count +=1} END {print count, sum}'
Sample data:
*
Summary - Thread 145 20 16 4 16 4
Summary - Thread 148 20 15 5 15 5
Summary - Thread 147 20 15 5 15 5
* this is column 7
awk '$5 == 2 {{s += $8} {c += 1}} END {print 2, s/c }' timing.txt >> sum.txt
du -s * | sort -nr
du -shc /cygdrive/c/*
du -sc /cygdrive/c/* | sort -n
grep "log message" logfile.log | awk '{ print $18 }' | sort | uniq -c
[cygwin] $ grep "Missing post body" mpi.log |awk '{print $18}' |sort |uniq -c |sort -rn
6 82.1.184.81
6 212.121.212.149
4 62.49.164.229
2 62.140.196.160
[cygwin] $
#!/bin/bash
# Check timestamps up to 3 minutes ago
prev3=`date +"%y/%m/%d %H:%M" -d -3minute`
prev2=`date +"%y/%m/%d %H:%M" -d -2minute`
prev1=`date +"%y/%m/%d %H:%M" -d -1minute`
now=`date +"%y/%m/%d %H:%M"`
logevent="Exception"
treshold=2
# check the log file
failCount=` egrep "$prev3|$prev2|$prev1|$now" /var/log/app_logfile.log | grep $logevent | wc -l `
# 3 or more log events in previous 3-4 minutes
if [ $failCount -gt $treshold ]; then
# notify someone
echo "failCount ($failCount) exceeds treshold ($treshold)" | mail -s "Alert from ${HOSTNAME}" support@mycompany.com
fi
diff -a -q -r dir1 dir2
[cygwin] release $ java -cp "bin/*:lib/*" com.tnsi.tap.Versin
java.lang.NoClassDefFoundError: com/tnsi/tap/Versin
Caused by: java.lang.ClassNotFoundException: com.tnsi.tap.Versin
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: com.tnsi.tap.Versin. Program will exit.
Exception in thread "main" [cygwin] release $
[cygwin] release $ java -cp "bin/*;lib/*" com.tnsi.tap.Version TNSPay Retail Gateway - TokenisationAdapter 1.0.0.1 23Nov2011 [cygwin] release $
sudo /sbin/init 3 # switch to shell with networking sudo /sbin/init 5 # switch back to GUI
/etc/inittab (set line id:3:initdefault: to the correct value).