Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
leojonathanoh committed Apr 15, 2021
2 parents ea43476 + 41f7bcb commit c3d06e3
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions benchie.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ if [ -z "$BENCHMARK_COMMANDS" ]; then
exit 1
fi

# OS-specific configuration
OS_ALPINE=
if cat /etc/os-release | grep -iE 'ID=alpine' > /dev/null 2>&1; then
OS_ALPINE='true'
fi

## Create directories
mkdir -p "$BENCHMARK_DATA_DIR"

Expand All @@ -141,23 +135,15 @@ if [ "$COMMAND" = 'status' ]; then
# Returns pid
echo "$BENCHMARK_COMMANDS" | while read -r c; do
# Exclude these args: 1) grep 2) zombie processes or kernel threads starting with square bracket i.e. [foo]'
if [ "$OS_ALPINE" = 'true' ]; then
for i in $( ps aux | grep "$c" | grep -vE '^\s*[0-9]+\s+(grep|\[)' | awk '{print $1}'); do echo "$i"; done
else
for i in $( ps aux | grep "$c" | grep -vE '^\s*[0-9]+\s+(grep|\[)' | awk '{print $2}'); do echo "$i"; done
fi
for i in $( ps -Ao pid,args | grep "$c" | grep -vE '^\s*[0-9]+\s+(grep|\[)' | awk '{print $1}'); do echo "$i"; done
done
fi
if [ "$COMMAND" = 'stop' ]; then
# Stops benchmarks
# Returns killed pid
echo "$BENCHMARK_COMMANDS" | while read -r c; do
# Exclude these args: 1) grep 2) zombie processes or kernel threads starting with square bracket i.e. [foo]'
if [ "$OS_ALPINE" = 'true' ]; then
for i in $( ps aux | grep "$c" | grep -vE '^\s*[0-9]+\s+(grep|\[)' | awk '{print $1}'); do echo "$i"; kill -9 "$i"; done
else
for i in $( ps aux | grep "$c" | grep -vE '^\s*[0-9]+\s+(grep|\[)' | awk '{print $2}'); do echo "$i"; kill -9 "$i"; done
fi
for i in $( ps -Ao pid,args | grep "$c" | grep -vE '^\s*[0-9]+\s+(grep|\[)' | awk '{print $1}'); do echo "$i"; kill -9 "$i"; done
done
fi
if [ "$COMMAND" = 'clean' ]; then
Expand Down

0 comments on commit c3d06e3

Please sign in to comment.