oravirt / ansible-oracle-modules

Oracle modules for Ansible
MIT License
214 stars 159 forks source link

oracle_opatch: Find running listener more robust #123

Open duhlig opened 4 years ago

duhlig commented 4 years ago

This PR should contain commit 42e65ec only. But it includes other unrelated commits.

This is the commit message:

Oracle_opatch searches the running listener with:

ps -elf | grep "[0-9] $ORACLE_HOME/bin/tnslsnr"

...then splits the line by spaces and takes the last but one field. This does not work for a "ps -ef" result like this:

0 S oracle 16921 1 0 80 0 - 43851 ep_pol 21:58 ? 00:00:00 /u01/app/oracle/product/12.1.0.2/ee/bin/tnslsnr LISTENER /dev/null -inherit

In this case "linelist[-2]" deliveres "/dev/null" instead of the LISTENER name. My fix is to search the ps line for the listener executable and use the next field.