-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor tests, add status checks, add child sub reaper tests and
reduce the number of images created for testing.
- Loading branch information
Showing
13 changed files
with
198 additions
and
65 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
|
||
# | ||
# Check options to figure out if we need to run the reaper as a child | ||
# process (!pid-1) or as the first process (as pid 1 replacing this script). | ||
# | ||
function _start_reaper() { | ||
local cfg=${1:-""} | ||
local forked=0 | ||
|
||
if [ -f "${cfg}" ]; then | ||
echo " - Checking if we need to run reaper as a child process ..." | ||
if grep -Ee '"DisablePid1Check":\s*true' "${cfg}" ; then | ||
forked=1 | ||
fi | ||
fi | ||
|
||
if [ "${forked}" -eq 1 ]; then | ||
echo " - Running reaper as child process ..." | ||
|
||
# Run testpid1 with a new parent and process group id/session id. | ||
bash <<EOF | ||
set -m | ||
echo " - New session pid = \$\$" | ||
echo " - Starting testpid1 ..." | ||
/reaper/testpid1 "$@" | ||
EOF | ||
|
||
exit $? | ||
fi | ||
|
||
|
||
echo " - Replacing init.sh with reaper as pid 1 ..." | ||
exec /reaper/testpid1 "$1" "$@" | ||
|
||
} # End of function _start_reaper. | ||
|
||
|
||
# | ||
# main(): | ||
# | ||
_start_reaper "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Pid": 0, | ||
"DisablePid1Check": true, | ||
"EnableChildSubreaper": true, | ||
"Status": true, | ||
"Debug": true, | ||
"Options": 0 | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# FROM scratch | ||
FROM fedora | ||
|
||
MAINTAINER [email protected] | ||
|
||
ADD ./bin /reaper/bin | ||
ADD testpid1 /reaper/testpid1 | ||
|
||
CMD ["/reaper/testpid1"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.