Skip to content
Snippets Groups Projects
Commit 12786cf3 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

_wait_for_free_slot: exclude ssh calls

parent 1c8144f1
Branches
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
# 2021-07-14 <axel.hahn@iml.unibe.ch> added _wait_for_free_slot in cert actions to execute multiple processes sequentially # 2021-07-14 <axel.hahn@iml.unibe.ch> added _wait_for_free_slot in cert actions to execute multiple processes sequentially
# 2021-09-27 <axel.hahn@iml.unibe.ch> softer behaviour: do not revoke changed certs (add does not stop; ensure does not delete) # 2021-09-27 <axel.hahn@iml.unibe.ch> softer behaviour: do not revoke changed certs (add does not stop; ensure does not delete)
# 2021-12-23 <axel.hahn@iml.unibe.ch> added param --trace as 1st param to generate a trace log # 2021-12-23 <axel.hahn@iml.unibe.ch> added param --trace as 1st param to generate a trace log
# 2022-01-10 <axel.hahn@iml.unibe.ch> _wait_for_free_slot: exclude ssh calls
# ====================================================================== # ======================================================================
...@@ -130,9 +131,9 @@ function _certTransfer(){ ...@@ -130,9 +131,9 @@ function _certTransfer(){
# internal function; show md5 hashsums for certificate, csr and key # internal function; show md5 hashsums for certificate, csr and key
# for visual comparison if the match # for visual comparison if the match
function _certMatching(){ function _certMatching(){
local md5_csr=$( test -f ${CM_filecsr} & openssl req -noout -modulus -in ${CM_filecsr} | openssl md5 | cut -f 2 -d " " ) local md5_csr=$( test -f ${CM_filecsr} && openssl req -noout -modulus -in ${CM_filecsr} | openssl md5 | cut -f 2 -d " " )
local md5_key=$( test -f ${CM_outfile_key} & openssl rsa -noout -modulus -in ${CM_outfile_key} | openssl md5 | cut -f 2 -d " " ) local md5_key=$( test -f ${CM_outfile_key} && openssl rsa -noout -modulus -in ${CM_outfile_key} | openssl md5 | cut -f 2 -d " " )
local md5_cert=$( test -f ${CM_outfile_cert} & openssl x509 -noout -modulus -in ${CM_outfile_cert} | openssl md5 | cut -f 2 -d " " ) local md5_cert=$( test -f ${CM_outfile_cert} && openssl x509 -noout -modulus -in ${CM_outfile_cert} | openssl md5 | cut -f 2 -d " " )
echo echo
echo "--- compare hashes" echo "--- compare hashes"
...@@ -263,13 +264,13 @@ function _wait_for_free_slot(){ ...@@ -263,13 +264,13 @@ function _wait_for_free_slot(){
_wd "--- Need to wait until own process PID $$ is on top ... " _wd "--- Need to wait until own process PID $$ is on top ... "
while [ $_bWait = true ]; while [ $_bWait = true ];
do do
_iFirstPID=$( ps -ef | grep "bash.*$0" | grep -v "grep" | sort -k 2 -n | head -1 | awk '{ print $2}' ) _iFirstPID=$( ps -ef | grep "bash.*$0" | grep -v "ssh.*@" | grep -v "grep" | sort -k 2 -n | head -1 | awk '{ print $2}' )
if [ $_iFirstPID -eq $$ ]; then if [ $_iFirstPID -eq $$ ]; then
_bWait=false _bWait=false
_wd "OK. Go!" _wd "OK. Go!"
else else
_wd "- all instances" _wd "- all instances"
test ${showdebug} && ps -ef | grep "bash.*$0" | grep -v "grep" | sort -k 2 -n test ${showdebug} && ps -ef | grep "bash.*$0" | grep -v "ssh.*@" | grep -v "grep" | sort -k 2 -n
sleep 10 sleep 10
fi fi
done done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment