-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sap_facts.sh - ps print only executable with path #28
base: dev
Are you sure you want to change the base?
sap_facts.sh - ps print only executable with path #28
Conversation
collection: merge dev to main for release 0.9.1
collection: merge dev to main for release 0.9.1 fix
9140fd1
to
46d9216
Compare
The output of "ps -ef" not also includes the command but also the process age and process arguments. Both can have digits in its string which may interfere when grepping for an instance number like 00 or 01. To fix this, let ps print only the executable with its path. Example: ps with default output - 2 lines match where only 1st line should match /usr/sap/A22/D01/exe/sapstartsrv pf=/usr/sap/A22/SYS/profile/A22_D01_sapa22u01 -D -u a22adm /usr/sap/A22/ASCS02/exe/sapstartsrv pf=/usr/sap/A22/SYS/profile/A22_ASCS02_sapa22u01 -D -u a22adm Example: ps with custom layout, only one line matches as expected /usr/sap/A22/D01/exe/sapstartsrv
46d9216
to
8ee8993
Compare
It's almost two months ago since I opened this pull request. Is there a timeline to get this change mainline? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
maybe you should have a look at community.sap_libs.sap_system_facts
https://docs.ansible.com/ansible/latest/collections/community/sap_libs/sap_system_facts_module.html
or maybe have a look at sap.sap_operations.host_info module |
I was wondering why the gathering of SAP facts was unstable. While digging through the sap_facts.sh script, I've figured that there is an issue with the ps command output. The name of the SAP instances, like 00 or 01 etc., can interfere with the process age or even with arguments.
I had to revise my code change. At first I used "ps -eo command" to prevent any interference with the process age. But later I figured it can also interfere with arguments. So I revised my patch to use "ps -eo exe".