From 99db626225508c205f6b8e5982224cd9e28443e7 Mon Sep 17 00:00:00 2001 From: breakwa11 Date: Mon, 15 Jun 2015 12:00:00 +0800 Subject: [PATCH] run script fix server restart --- db_transfer.py | 2 +- run.sh | 6 ++++++ stop.sh | 3 +++ tail.sh | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 run.sh create mode 100644 stop.sh create mode 100644 tail.sh diff --git a/db_transfer.py b/db_transfer.py index fc1c80d..3e95f5c 100644 --- a/db_transfer.py +++ b/db_transfer.py @@ -118,7 +118,7 @@ class DbTransfer(object): logging.info('db stop server at port [%s] reason: password changed' % (port,)) ServerPool.get_instance().del_server(port) - if allow and ServerPool.get_instance().server_is_run(port) == 0: + elif allow and ServerPool.get_instance().server_run_status(port) is False: logging.info('db start server at port [%s] pass [%s]' % (port, passwd)) ServerPool.get_instance().new_server(port, passwd) diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..a469852 --- /dev/null +++ b/run.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +eval $(ps -ef | grep "[0-9] python server\\.py" | awk '{print "kill "$2}') +nohup python server.py >> ssserver.log 2>&1 & + +tail -f ssserver.log diff --git a/stop.sh b/stop.sh new file mode 100644 index 0000000..2fa55cf --- /dev/null +++ b/stop.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +eval $(ps -ef | grep "[0-9] python server\\.py" | awk '{print "kill "$2}') diff --git a/tail.sh b/tail.sh new file mode 100644 index 0000000..aa37139 --- /dev/null +++ b/tail.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +tail -f ssserver.log