Skip to content

Commit ce1d8f1

Browse files
committed
fix the background process' backup parent check
1 parent 8f5ace1 commit ce1d8f1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

htgettoken.spec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ rm -rf $RPM_BUILD_ROOT
8787
# - Use wheels to build/install Python package, which simplified the entry
8888
# points and improves (slightly) the metadata
8989

90+
91+
#- Fix the httokensh background process's check for its parent process.
92+
# That is only a backup in case only the parent process is hard-killed,
93+
# because normally the parent process kills the background process when
94+
# the parent exits.
95+
9096
* Thu Aug 17 2023 Dave Dykstra <[email protected]> 1.20-1
9197
- Update httokensh to by default set the minimum vault token time to live to
9298
6 days, and to make sure that the background refresh never gets a new vault

httokensh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,18 @@ set -m
136136

137137
echo "Renewal log is at \$BEARER_TOKEN_FILE.log"
138138
{
139+
# keep a copy of $PPID because it will change to 1 if parent dies
140+
PARENTPID=$PPID
139141
echo htgettoken args are "${HTGETTOKENARGS[@]}"
140142
while true; do
141143
date
142144
echo "Renewal scheduled in $SLEEPSECS seconds"
143145
sleep $SLEEPSECS
144146
date
145-
if kill -0 $PPID; then
147+
if kill -0 $PARENTPID; then
146148
gettoken "exiting" 60
147149
else
148-
echo "Parent process $PPID not running, exiting"
150+
echo "Parent process $PARENTPID not running, exiting"
149151
exit 0
150152
fi
151153
done

0 commit comments

Comments
 (0)