Last active
June 12, 2016 10:55
-
-
Save fff/a110e7f7ef9e3c822e793a4c9977c29e to your computer and use it in GitHub Desktop.
restart several go agents in one batch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
# dir structure | |
# |- go-agent-16.3.0_00 | |
# |- go-agent-16.3.0_01 | |
# |- go-agent-16.3.0_02 | |
# |- go-agent-16.3.0_03 | |
# |- go-agent-16.3.0_04 | |
# |- go-agent-16.3.0_05 | |
# |- restart_all.sh | |
go_version=16.3.0 | |
function force_kill(){ | |
ps x|grep _$1|grep java|awk '{print $1}'|kill -9 || echo not exist | |
rm -f .agent-bootstrapper.running | |
} | |
function restart(){ | |
pushd go-agent-${go_version}_$1 >> /dev/null | |
./stop-agent.sh || force_kill $1 | |
./agent.sh | |
echo Agent $1 is running with pid:`cat go-agent.pid` | |
popd >> /dev/null | |
} | |
export DAEMON='Y' | |
export AGENT_MEM="256m" | |
export AGENT_MAX_MEM="512m" | |
restart 00 | |
restart 01 | |
restart 02 | |
restart 03 | |
restart 04 | |
restart 05 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment