Move some common scripts from multinode-demo/ to scripts/

This commit is contained in:
Michael Vines
2018-08-27 10:23:22 -07:00
parent cd0db7842c
commit bd5c6158ae
13 changed files with 106 additions and 81 deletions

20
scripts/oom-score-adj.sh Normal file
View File

@ -0,0 +1,20 @@
# |source| this file
#
# Adjusts the OOM score for the specified process. Linux only
#
# usage: oom_score_adj [pid] [score]
#
oom_score_adj() {
declare pid=$1
declare score=$2
if [[ $(uname) != Linux ]]; then
return
fi
echo "$score" > "/proc/$pid/oom_score_adj" || true
declare currentScore
currentScore=$(cat "/proc/$pid/oom_score_adj" || true)
if [[ $score != "$currentScore" ]]; then
echo "Failed to set oom_score_adj to $score for pid $pid (current score: $currentScore)"
fi
}