From a1ad197ebecf3c7ab6d52e7489fa1152c22c2b04 Mon Sep 17 00:00:00 2001 From: Cassandra Heart Date: Fri, 31 May 2024 14:27:42 -0500 Subject: [PATCH] update autorun script to cpulimit child processes --- node/release_autorun.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/node/release_autorun.sh b/node/release_autorun.sh index 1649541..ef4e32e 100755 --- a/node/release_autorun.sh +++ b/node/release_autorun.sh @@ -3,12 +3,20 @@ start_process() { version=$(cat config/version.go | grep -A 1 "func GetVersion() \[\]byte {" | grep -Eo '0x[0-9a-fA-F]+' | xargs printf "%d.%d.%d") if [[ "$OSTYPE" == "linux-gnu"* ]]; then + if ! which cpulimit; then + echo "cpulimit not installed, please install it before running the node" + exit 1 + fi if [[ $(uname -m) == "aarch64"* ]]; then ./node-$version-linux-arm64 & main_process_id=$! + sleep 20 + ps -eo pid,args | grep "node-$version-linux-arm64 --core" | grep -v grep | gawk '{print $1}' | xargs -L 1 cpulimit -l 50 -z -b -p else ./node-$version-linux-amd64 & main_process_id=$! + sleep 20 + ps -eo pid,args | grep "node-$version-linux-amd64 --core" | grep -v grep | gawk '{print $1}' | xargs -L 1 cpulimit -l 50 -z -b -p fi elif [[ "$OSTYPE" == "darwin"* ]]; then ./node-$version-darwin-arm64 &