awk:
awk '{if ((NR > n1) && (NR < n2)) print $0}' text_file_name
perl:
perl -ne 'print n1..n2' text_file_name
星期三, 5月 30, 2018
星期二, 5月 29, 2018
How to simulate process hang in Linux
To simulate the process hang, you can use the kill command with SIGSTOP signal
for example:
kill -SIGSTOP pid
My case:
I tried to recreate the MQ client process hang and didn't reply the heartbeat packet to qmgr to see we can get what kind of error in qmgr error log.
.
step 1: start MQ client
#./amqsputc LQ1 QM1
step 2: find out the pid
#ps -ef|grep amqsputc
step 3: send SIGSTOP to the pid
#kill -SIGSTOP pid
check the qmgr error log and I can find out the following error message
-----------------------------------------------------
AMQ9271: Channel 'svrconn' timed out.
EXPLANATION:
A timeout occurred while waiting to receive from the other end of channel
'svrconn'. The address of the remote end of the connection was
'192.168.xxx.xxx'.
ACTION:
The return code from the select() [TIMEOUT] 35 seconds call was 4 (X'4').
Record these values and tell the systems administrator.
for example:
kill -SIGSTOP pid
My case:
I tried to recreate the MQ client process hang and didn't reply the heartbeat packet to qmgr to see we can get what kind of error in qmgr error log.
.
step 1: start MQ client
#./amqsputc LQ1 QM1
step 2: find out the pid
#ps -ef|grep amqsputc
step 3: send SIGSTOP to the pid
#kill -SIGSTOP pid
check the qmgr error log and I can find out the following error message
-----------------------------------------------------
AMQ9271: Channel 'svrconn' timed out.
EXPLANATION:
A timeout occurred while waiting to receive from the other end of channel
'svrconn'. The address of the remote end of the connection was
'192.168.xxx.xxx'.
ACTION:
The return code from the select() [TIMEOUT] 35 seconds call was 4 (X'4').
Record these values and tell the systems administrator.
-------------------------------------------------------
In this case, the qmgr will close the connection due to no response from MQ client after heartbeat interval. The MQ client will report 2009 error (connection broken, reset by peer) after come back from hang issue.
To continue the process, you can use kill with SIGCONT signal.
星期二, 5月 08, 2018
Custom Properties for improving application startup in WebSphere Application Server
Custom Properties for improving application startup in WebSphere Application Server
Problem(Abstract)
In WebSphere Application Server traditional V9.0, Contexts and Dependency Injection (CDI) 1.2 is enabled by default. Enablement of CDI 1.2 might increase unnecessary performance overhead if the application does not use CDI.
Symptom
The application starts slowly.
Resolving the problem
Disable CDI processing steps for applications or archives that do not contain CDI content, and for which the steps are unnecessary. The following Java custom properties and manifest attributes are introduced to disable CDI processing steps:
Name: com.ibm.ws.cdi.enableImplicitBeanArchives
Allowed Values: true, false
Default Value: true
Description: By setting the
com.ibm.ws.cdi.enableImplicitBeanArchives custom property to false, CDI-related annotation scanning steps are disabled for archives that do not contain a bean descriptor, for example, the beans.xml file.Name: com.ibm.ws.cdi.enableCDI
Allowed Values: true, false
Default Value: true
Description: By setting the
com.ibm.ws.cdi.enableCDI custom property to false, all CDI steps are disabled. Set the value to false if no CDI is needed on the server level.In addition to these Java custom properties that impact all applications that are deployed to the target server, the following properties can be set in the server-wide
amm.filter.properties file and as manifest attributes of application archive files.- System Property Name: com.ibm.ws.cdi.enableImplicitBeanArchives
Property and Manifest Attribute Name: Enable-Implicit-Bean-Archive
- System Property Name: com.ibm.ws.cdi.enableCDI
Property and Manifest Attribute Name: Enable-CDI
Note:
- The
amm.filter.propertiesfile is located atWAS_HOME/properties/amm.filter.properties. - Manifest attributes are set as main manifest attributes in Java EE-related application archive files, such as EAR, WAR, RAR, and JAR files.
- The Enable-CDI property affects an entire application. Set this property on the
Manifest.mffile of the application. Setting this property only for a module archive has no effect.
In this way, the property value from the least enclosing scope is used. An attribute value on a module manifest takes precedence over the attribute value on the application. The attribute value on the application takes precedence over a java custom property value. The java custom property value takes precedence over a property value set in the
amm.filter.properties file.For more information about similar properties, see Reducing annotation searches during application deployment in IBM Knowledge Center.
標籤:
application,
CDI,
custom property,
scan,
slow,
start,
v9,
WAS
星期五, 4月 27, 2018
alias 無法使用多個指令串接解決方法
因為練習Docker, 想要把以下指令串寫成一個alias 命令來一次刪除所有的container
docker ps -a|awk '{print $1}'|grep -v CONTAINER|xargs -n 1 docker rm
但發現bash會認為語法不對, 在stackoverflow 發現以下解法, 將其寫成function (.bashrc)
docrmall() {
docker ps -a|awk '{print $1}'|grep -v CONTAINER|xargs -n 1 docker rm
}
以後只要呼叫 docrmall就可以了!
Syntax error when trying to pipe multiple commands in an alias definition
*** update: 發現另外方式更快, 主要是 -q 這個選項可以只輸出id, 不需再去grep
(1) docker rm -f $(docker ps -aq)
或是
(2) docker ps -aq|xargs docker rm
***
$( ) ---> 取得( ) 內的指令輸出內容
docker ps -a|awk '{print $1}'|grep -v CONTAINER|xargs -n 1 docker rm
但發現bash會認為語法不對, 在stackoverflow 發現以下解法, 將其寫成function (.bashrc)
docrmall() {
docker ps -a|awk '{print $1}'|grep -v CONTAINER|xargs -n 1 docker rm
}
以後只要呼叫 docrmall就可以了!
Syntax error when trying to pipe multiple commands in an alias definition
***
xargs -n 1 : 代表一次用一個值傳給後面的命令當輸入值
Linux 系統 xargs 指令範例與教學
*** update: 發現另外方式更快, 主要是 -q 這個選項可以只輸出id, 不需再去grep
(1) docker rm -f $(docker ps -aq)
或是
(2) docker ps -aq|xargs docker rm
***
$( ) ---> 取得( ) 內的指令輸出內容
星期三, 4月 18, 2018
find out the number of current using channel
查看channel 目前使用數量 (只會有client mode)
echo 'dis chstatus(*) ALL'|runmqsc your_qmgr_name|grep AMQ8417|wc -l
查看總連線數 (會包含binding mode和client mode)
echo 'dis conn(*) ALL'|runmqsc your_qmgr_name|grep CHANNEL|wc -l
星期二, 4月 17, 2018
DB2 APAR PI47282 needed when using JAVA SDK8 in WebSphere Application Server V8.5.5.9+
DB2 APAR PI47282 needed when using JAVA SDK8 in WebSphere Application Server V8.5.5.9+
http://www-01.ibm.com/support/docview.wss?uid=swg21982343
PI47282: NEW RELEASE OF THE IBM DB2 DRIVER FOR JDBC AND SQLJ (RELEASE 4.19) PROVIDING VARIOUS ENHANCEHMENT
http://www-01.ibm.com/support/docview.wss?uid=swg1PI47282
SqlException: unsupported encoding Cp037 for result set column
Unsupported ccsid, encoding, or locale: "Cp037". ERRORCODE=-4220, SQLSTATE=22021
WAS may get the following error:
Unsupported ccsid, encoding, or locale: "Cp037". ERRORCODE=-4220, SQLSTATE=22021
http://www-01.ibm.com/support/docview.wss?uid=swg21982343
PI47282: NEW RELEASE OF THE IBM DB2 DRIVER FOR JDBC AND SQLJ (RELEASE 4.19) PROVIDING VARIOUS ENHANCEHMENT
http://www-01.ibm.com/support/docview.wss?uid=swg1PI47282
SqlException: unsupported encoding Cp037 for result set column
Unsupported ccsid, encoding, or locale: "Cp037". ERRORCODE=-4220, SQLSTATE=22021
WAS may get the following error:
Unsupported ccsid, encoding, or locale: "Cp037". ERRORCODE=-4220, SQLSTATE=22021
星期二, 3月 06, 2018
How do you define a MQ trigger monitor service?
How do you define a MQ trigger monitor service?
https://developer.ibm.com/answers/questions/397542/how-do-you-define-a-mq-trigger-monitor-service.html
https://developer.ibm.com/answers/questions/397542/how-do-you-define-a-mq-trigger-monitor-service.html
The following MQSC command defines a trigger monitor service called INIT. It is used to trigger the start of an application to get a message from a queue. WMQ is installed in the default location of "C:\Program Files\Websphere MQ". The name of the initiation queue is "MY.INITQ".
You can add a description [DESCR] within single quotes if you want. 'tm_out' and 'tm_err' define the name of output an error date for this service respectively. These files can be deleted if you feel they have become to large. They will be recreated if needed. The definitions that begin and end with '+' are place holders.
Refer to DEFINE SERVICE for more information on defining a service.
Note: (a) Only customize items in BOLD ITALICS for your environment.
(b) You may customize the STDOUT and STDERR filename and path.
(b) You may customize the STDOUT and STDERR filename and path.
1 - Modify the command for your environment.
2 - Open a command prompt, type: RUNMQSC [Your_Queue_Manager_Name].
3 - Copy and Paste the modified command into the RUNMQSC window press .
DEFINE SERVICE ('INIT') +
DESCR(' ') +
STARTCMD('+MQ_INSTALL_PATH+bin64\runmqtrm') +
STARTARG('-m +QMNAME+ -q MY.INITQ') +
STOPCMD('+MQ_INSTALL_PATH+bin64\amqsstop') +
STOPARG('-m +QMNAME+ -p +MQ_SERVER_PID+') +
STDOUT('C:\Program Files\IBM\WebSphere MQ\errors\tm_out') +
STDERR('C:\Program Files\IBM\WebSphere MQ\errors\tm_err') +
CONTROL(QMGR) +
SERVTYPE(SERVER) +
REPLACE
DESCR(' ') +
STARTCMD('+MQ_INSTALL_PATH+bin64\runmqtrm') +
STARTARG('-m +QMNAME+ -q MY.INITQ') +
STOPCMD('+MQ_INSTALL_PATH+bin64\amqsstop') +
STOPARG('-m +QMNAME+ -p +MQ_SERVER_PID+') +
STDOUT('C:\Program Files\IBM\WebSphere MQ\errors\tm_out') +
STDERR('C:\Program Files\IBM\WebSphere MQ\errors\tm_err') +
CONTROL(QMGR) +
SERVTYPE(SERVER) +
REPLACE
4 - Type "END" and press .
NOTE: This information was originally in technote #1284004
technote #1284004
Basic process triggering using runmqtrm defined as a service in WebSphere MQ 7.5 and 8.0
訂閱:
文章 (Atom)