Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
certman
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
certman
Merge requests
!17
update _wait_4_free_slot and data in debug.log
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
update _wait_4_free_slot and data in debug.log
track-requests
into
master
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Hahn Axel (hahn)
requested to merge
track-requests
into
master
2 years ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
50444af8
1 commit,
2 years ago
1 file
+
14
−
14
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
cm.sh
+
14
−
14
Options
@@ -33,6 +33,7 @@
# 2022-04-20 <axel.hahn@iml.unibe.ch> fix multiple domains using domain alias
# 2022-04-21 <axel.hahn@iml.unibe.ch> mix multiple domains using domain alias or not
# 2022-05-19 <axel.hahn@iml.unibe.ch> add timer and debug.log
# 2022-05-20 <axel.hahn@iml.unibe.ch> update _wait_4_free_slot and data in debug.log
# ======================================================================
@@ -327,13 +328,7 @@ function _testUser(){
# param string(s) message
function
_debuglog
(){
if
[
${
CM_writedebuglog
}
-eq
1
]
;
then
local
_sProcesses
typeset
-i
local
_iProcesses
typeset
-i
local
_iPos
_sProcesses
=
$(
ps
-ef
|
grep
"bash.*
$0
"
|
grep
-v
"ssh.*@"
|
grep
-v
"grep"
|
sort
-k
2
-n
)
_iProcesses
=
$(
echo
"
$_sProcesses
"
|
wc
-l
)
_iPos
=
$(
echo
"
$_sProcesses
"
|
grep
-n
"
$$
"
|
head
-1
|
cut
-f
1
-d
':'
)
echo
"
$(
date
)
$CM_fqdn
[
$$
] |
$(
show_timer
)
| pos
$_iPos
of
$_iProcesses
processes |
$*
"
>>
${
debuglogfile
}
echo
"
$(
date
)
$CM_fqdn
[
$$
] |
$(
show_timer
)
|
$*
"
>>
${
debuglogfile
}
fi
}
@@ -351,23 +346,28 @@ function _wait_for_free_slot(){
local
_bWait
=
true
_debuglog
"start in _wait_for_free_slot"
typeset
-i
local
_iFirstPID
=
0
typeset
-i
local
_iPos
=
0
local
_sProcesses
sleep
3
_wd
"--- Need to wait until own process PID
$$
is on top ... "
while
[
$_bWait
=
true
]
;
do
_sProcesses
=
$(
ps
-ef
|
grep
"bash.*
$0
"
|
grep
-v
"ssh.*@"
|
grep
-v
"grep"
|
sort
-k
2
-n
)
# _iFirstPID=$( ps -ef | grep "bash.*$0" | grep -v "ssh.*@" | grep -v "grep" | sort -k 2 -n | head -1 | awk '{ print $2}' )
_iFirstPID
=
$(
echo
"
$_sProcesses
"
|
head
-1
|
awk
'{ print $2}'
)
_iPos
=
$(
echo
"
$_sProcesses
"
|
grep
-n
"
$$
"
|
head
-1
|
cut
-f
1
-d
':'
)
_wd
"instances:
$_iProcesses
"
test
${
CM_showdebug
}
-ne
0
&&
echo
"
$_sProcesses
"
if
[
$_iFirstPID
-eq
$$
]
;
then
# if [ $_iFirstPID -eq $$ ]; then
if
[
$_iPos
-eq
1
]
;
then
_bWait
=
false
_debuglog
"GO from _wait_for_free_slot"
_wd
"OK. Go!"
else
_wd
"- all instances"
_debuglog
"waiting in _wait_for_free_slot"
# test ${CM_showdebug} && ps -ef | grep "bash.*$0" | grep -v "ssh.*@" | grep -v "grep" | sort -k 2 -n
test
${
CM_showdebug
}
-ne
0
&&
echo
"
$_sProcesses
"
_iProcesses
=
$(
echo
"
$_sProcesses
"
|
wc
-l
)
_iFirstPID
=
$(
echo
"
$_sProcesses
"
|
head
-1
|
awk
'{ print $2}'
)
_debuglog
"zzz ... waiting in _wait_for_free_slot ...
$_iFirstPID
is first ... my pos is
$_iPos
of
$_iProcesses
"
sleep
10
fi
done
Loading