Skip to content

Commit c94424d

Browse files
committed
Output killjava.sh to console
Previously, the killjava.sh script output was directed to a file. This worked previously with the crashlogs command to ensure that users could see what had gone wrong. With the removal of the crashlogs command, this command no longer worked properly. This change updates the script to output to the console instead, where the output will be picked up by loggregator. [#57139852][resolves #79]
1 parent 717d8bf commit c94424d

2 files changed

Lines changed: 48 additions & 20 deletions

File tree

resources/open_jdk_jre/bin/killjava.sh

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,34 @@
1717

1818
# Kill script for use as the parameter of OpenJDK's -XX:OnOutOfMemoryError
1919

20-
COMMAND='pkill -9 -f .*-XX:OnOutOfMemoryError=.*killjava.*'
21-
LOG_FILE="$PWD/.out-of-memory.log"
20+
set -e
2221

23-
function log {
24-
echo "$(date +%FT%T.%2N%z) FATAL $1" >> $LOG_FILE
25-
}
26-
27-
log "Attempting to kill Java processes using '$COMMAND'"
28-
log "Processes Before:
22+
echo "
23+
Process Status (Before)
24+
=======================
2925
$(ps -ef)
26+
27+
ulimit (Before)
28+
===============
29+
$(ulimit -a)
30+
31+
Free Disk Space (Before)
32+
========================
33+
$(df -h)
3034
"
3135

32-
$($COMMAND)
36+
pkill -9 -f .*-XX:OnOutOfMemoryError=.*killjava.*
3337

34-
log "Processes After:
38+
echo "
39+
Process Status (After)
40+
======================
3541
$(ps -ef)
42+
43+
ulimit (After)
44+
==============
45+
$(ulimit -a)
46+
47+
Free Disk Space (After)
48+
=======================
49+
$(df -h)
3650
"

resources/oracle_jre/bin/killjava.sh

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,34 @@
1717

1818
# Kill script for use as the parameter of OpenJDK's -XX:OnOutOfMemoryError
1919

20-
COMMAND='pkill -9 -f .*-XX:OnOutOfMemoryError=.*killjava.*'
21-
LOG_FILE="$PWD/.out-of-memory.log"
20+
set -e
2221

23-
function log {
24-
echo "$(date +%FT%T.%2N%z) FATAL $1" >> $LOG_FILE
25-
}
26-
27-
log "Attempting to kill Java processes using '$COMMAND'"
28-
log "Processes Before:
22+
echo "
23+
Process Status (Before)
24+
=======================
2925
$(ps -ef)
26+
27+
ulimit (Before)
28+
===============
29+
$(ulimit -a)
30+
31+
Free Disk Space (Before)
32+
========================
33+
$(df -h)
3034
"
3135

32-
$($COMMAND)
36+
pkill -9 -f .*-XX:OnOutOfMemoryError=.*killjava.*
3337

34-
log "Processes After:
38+
echo "
39+
Process Status (After)
40+
======================
3541
$(ps -ef)
42+
43+
ulimit (After)
44+
==============
45+
$(ulimit -a)
46+
47+
Free Disk Space (After)
48+
=======================
49+
$(df -h)
3650
"

0 commit comments

Comments
 (0)