This commit is contained in:
aozhiwei 2020-02-02 23:06:24 +08:00
parent 1680f0d93b
commit 3000749b53
2 changed files with 10 additions and 3 deletions

View File

@ -33,7 +33,7 @@ def stop(instance_id, jar_name):
for pid in pids: for pid in pids:
exepath = getExePath(pid) exepath = getExePath(pid)
cmdline = getExeCmdLine(pid) cmdline = getExeCmdLine(pid)
if cmdline == ("./%s\0-i\0%d\0-n\0%d\0" % (jar_name, instance_id, node_id)): if cmdline.find('-Dinstance_id="%s"' % instance_id) != -1:
os.popen('kill -9 %d' % int(pid)) os.popen('kill -9 %d' % int(pid))
def listServer(jar_name): def listServer(jar_name):
@ -50,12 +50,12 @@ def restartServer(str_instance_ids, jar_name):
stop(instance_id, jar_name) stop(instance_id, jar_name)
time.sleep(0.5) time.sleep(0.5)
print('%s %d starting......' % (jar_name, instance_id)) print('%s %d starting......' % (jar_name, instance_id))
cmd = 'sh start_instance.sh %d %d' % (instance_id) cmd = 'sh start_instance.sh %d' % (instance_id)
os.popen(cmd) os.popen(cmd)
time.sleep(0.5) time.sleep(0.5)
def printHelp(): def printHelp():
print('usuage: [restart stop list]') print('usuage: [restart list]')
def main(argv): def main(argv):
if len(argv) == 1: if len(argv) == 1:

View File

@ -0,0 +1,7 @@
#!/bin/bash
source ./common.sh
mkdir -p logs
java -jar ${JAVA_OPTS} -Dinstance_id="$1" -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j.configurationFile=${LOG4J2_FILE} ${JAR_NAME} >> logs/app_$1.out 2>&1 &