Skip to main content

Posts

Showing posts from December, 2012

JBOSS7 Logging with Size Rotating

To change jboss7 log rotating from periodic to size base, comment periodic-rotating-file-handler and insert the following size-rotating-file-handler into standalone.xml

HTML parser for Java

There are a lot of tools and libraries for parsing html in java language. One of them is HTML Parser. HTML Parser is a Java library used to parse HTML. It is used for transformation or extraction, it features filters, visitors, custom tags and easy to use JavaBeans. It is a fast, robust and well tested package.
Homepage: http://htmlparser.sourceforge.net

MSSQL Server Differential Backup Failure

Date  Log Job History (TestDB_Maintenance_Plan.TestDB_Diff_Subplan) Step ID 1 Server TestSRV Job Name TestDB_Maintenance_Plan.TestDB_Diff_Subplan Step Name TestDB_Diff_Subplan Duration 00:00:05 Sql Severity 0 Sql Message ID 0 Operator Emailed  Operator Net sent  Operator Paged  Retries Attempted 0

Shell script for getting total amount of the system memory

In order to get total amount of the system memory as GigaByte in a bash script:
#!/bin/bash mem_line=`cat /proc/meminfo |grep MemTotal` mem_kb=`echo $mem_line | tr -cd '[[:digit:]]'` mem_gb=$(awk "BEGIN{print $mem_kb/1024/1024}") echo "System Memory (KB): "$mem_kb echo "System Memory (GB): "$mem_gb

Linux shell script get file timestamp as seconds

This is accomplished using stat command. -c parameter is for the specified FORMAT instead of the default %Y is for the Time of last modification as seconds since Epoch
#!/bin/bash $file="/tmp/testfile" file_time_stamp=$(stat -c %Y $file) echo $file_time_stamp

Shell script generate random number

$RANDOM can be used for generating random number in bash. $RANDOM generate an integer value. For example if you want to generate number as minutes, the command just like:
# echo $[ RANDOM % 60 ] 34