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
Commits
50444af8
Commit
50444af8
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
update _wait_4_free_slot and data in debug.log
parent
e0eb6028
No related branches found
No related tags found
1 merge request
!17
update _wait_4_free_slot and data in debug.log
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cm.sh
+14
-14
14 additions, 14 deletions
cm.sh
with
14 additions
and
14 deletions
cm.sh
+
14
−
14
View file @
50444af8
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment