File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -137,11 +137,15 @@ spec:
137
137
- bash
138
138
- ' -c'
139
139
- |
140
- pid=$(ps aux | grep -i '/bin/bas[h] /usr' | awk {'print $2'} )
140
+ pid=$(pgrep start.marklogic )
141
141
142
142
log () {
143
143
local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
144
- echo "${TIMESTAMP} $@" > /proc/$pid/fd/1
144
+ # Check to make sure pod doesn't terminate if PID value is empty for any reason
145
+ # If PID value is empty postStart hook logs are not recorded
146
+ if [ -n "$pid" ]; then
147
+ echo "${TIMESTAMP} $@" > /proc/$pid/fd/1
148
+ fi
145
149
}
146
150
log "Info: [poststart] Begin Poststart Hook Execution"
147
151
if [[ $POD_NAME != *-0 ]]; then
@@ -168,10 +172,14 @@ spec:
168
172
- |
169
173
log () {
170
174
local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
171
- echo "${TIMESTAMP} $@" > /proc/$pid/fd/1
175
+ # Check to make sure pod doesn't terminate if PID value is empty for any reason
176
+ # If PID value is empty preStart hook logs are not recorded
177
+ if [ -n "$pid" ]; then
178
+ echo "${TIMESTAMP} $@" > /proc/$pid/fd/1
179
+ fi
172
180
}
173
181
174
- pid=$(ps aux | grep -i '/bin/bas[h] /usr' | awk {'print $2'} )
182
+ pid=$(pgrep start.marklogic )
175
183
log "Info: [prestop] Prestop Hook Execution"
176
184
177
185
my_host=$(hostname -f)
You can’t perform that action at this time.
0 commit comments