Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zombienet-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
parity
Mirrored projects
zombienet-sdk
Commits
df5045e6
Unverified
Commit
df5045e6
authored
1 year ago
by
Javier Viola
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(orchestrator): wrapper stderr redirection (#176)
Fix typo :)
parent
aa55f109
Branches
Branches containing commit
No related merge requests found
Pipeline
#449354
passed with stage
in 16 minutes and 56 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
crates/provider/src/kubernetes/scripts/zombie-wrapper.sh
+27
-16
27 additions, 16 deletions
crates/provider/src/kubernetes/scripts/zombie-wrapper.sh
with
27 additions
and
16 deletions
crates/provider/src/kubernetes/scripts/zombie-wrapper.sh
+
27
−
16
View file @
df5045e6
...
...
@@ -51,20 +51,36 @@ child_pid=""
# get the command to exec
CMD
=(
$@
)
# File to store CMD (and update from there)
ZOMBIE_CMD_FILE
=
/cfg/zombie.cmd
# Store the cmd and make it available to later usage
# NOTE: echo without new line to allow to customize the cmd later
$ECHO
-n
"
${
CMD
[@]
}
"
>
$ZOMBIE_CMD_FILE
echo
"COMMAND TO RUN IS:
$CMD
"
start
()
{
# redirect the output to be expored to loki
"
${
CMD
[@]
}
"
>>
/proc/1/fd/1 2
>>
/proc/1/fd/2 &
child_pid
=
"
$!
"
# store pid
$ECHO
${
child_pid
}
>
/cfg/zombie.pid
# check if the process is running
if
!
$LS
/proc/
$child_pid
>
/dev/null 2>&1
;
then
exit
1
"
${
CMD
[@]
}
"
>>
/proc/1/fd/1 2>> /proc/1/fd/2 &
if
[[
"
$CMD
"
!=
"cat"
]]
;
then
child_pid
=
"
$!
"
$ECHO
$(
cat
$ZOMBIE_CMD_FILE
)
# store pid
$ECHO
${
child_pid
}
>
/cfg/zombie.pid
# check if the process is running
if
!
$LS
/proc/
$child_pid
>
/dev/null 2>&1
;
then
echo
"child process doesn't exist, quiting..."
;
exit
1
;
else
echo
"PID:
$child_pid
alive"
;
fi
;
else
echo
"PID not stored, since was 'cat'"
;
fi
;
}
restart
()
{
...
...
@@ -96,9 +112,9 @@ resume() {
# keep listening from the pipe
while
read
line <
$pipe
do
if
[[
"
$line
"
==
'
start
'
]]
;
then
if
[[
"
$line
"
==
"
start
"
]]
;
then
start
elif
[[
"
$line
"
==
'
quit
'
]]
;
then
elif
[[
"
$line
"
==
"
quit
"
]]
;
then
break
elif
[[
"
$line
"
=
~
"restart"
]]
;
then
# check if we have timeout between restart
...
...
@@ -114,9 +130,4 @@ do
fi
done
# exit
if
[
!
-z
"
${
child_pid
}
"
]
;
then
$KILL
-9
"
$child_pid
"
fi
exit
0
This diff is collapsed.
Click to expand it.
Preview
0%
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