Skip to content

Commit 9140fd1

Browse files
committed
sap_facts.sh - print only command column with ps
The output of "ps -ef" not also includes the command but also the process age. When grepping for instance number '00', it can also match for a displayed process age like 00:00:01. So only print the columns that are really needed which is the command. Example: desadm 2640 1 0 15:16 ? 00:00:00 /usr/sap/DES/ASCS01/exe/sapstartsrv pf=/usr/sap/DES/SYS/profile/DES_ASCS01_sapdes -D -u desadm ^^ ^^ ^^ desadm 2879 1 0 15:16 ? 00:00:01 /usr/sap/DES/D00/exe/sapstartsrv pf=/usr/sap/DES/SYS/profile/DES_D00_sapdes -D -u desadm Only line 2 should match but because of the time value, the first line matches also when grepping for instance 00.
1 parent e247f47 commit 9140fd1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/modules/sap_facts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function check_sapstartsrv(){
286286
# $3 - NR
287287

288288
## Count the number of sapstartsrv processes
289-
SAPSTARTSRV=$(ps -ef | grep $2 | grep $3 | grep sapstartsrv | wc -l)
289+
SAPSTARTSRV=$(ps -eo command | grep $2 | grep $3 | grep sapstartsrv | wc -l)
290290

291291
if [[ $SAPSTARTSRV = 0 ]]; then
292292
## No sapstartsrv process running - attempt to start

0 commit comments

Comments
 (0)