From a39424ac092a26419fc0f6d54d018a8ceb79cb17 Mon Sep 17 00:00:00 2001 From: ibuler Date: Sun, 25 Mar 2018 21:48:41 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0jms=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jms | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/jms b/jms index 08505cc17..5101e8697 100755 --- a/jms +++ b/jms @@ -80,10 +80,14 @@ def get_log_file_path(service): def get_pid(service): pid_file = get_pid_file_path(service) + pid = 0 if os.path.isfile(pid_file): with open(pid_file) as f: - return int(f.read().strip()) - return 0 + try: + return int(f.read().strip()) + except ValueError: + pass + return pid def is_running(s, unlink=True): @@ -282,9 +286,9 @@ if __name__ == '__main__': parser = argparse.ArgumentParser( description=""" Jumpserver service control tools; - - Example: \r\n - + + Example: \r\n + %(prog)s start all -d; """ )