diff options
author | morpheus65535 <[email protected]> | 2018-10-10 07:15:06 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2018-10-10 07:15:06 -0400 |
commit | 1cccd810ae6bb750f91dc0fcde7d7aedf91b802a (patch) | |
tree | a35c780abaf807db333c295d59e3bea9c8791b18 /bazarr.py | |
parent | 56226f941da8266539ce1e1c5957a85f0356ebbd (diff) | |
download | bazarr-1cccd810ae6bb750f91dc0fcde7d7aedf91b802a.tar.gz bazarr-1cccd810ae6bb750f91dc0fcde7d7aedf91b802a.zip |
Auto reload after restart
Diffstat (limited to 'bazarr.py')
-rw-r--r-- | bazarr.py | 23 |
1 files changed, 10 insertions, 13 deletions
@@ -30,20 +30,17 @@ def start_bazarr(): script = [sys.executable, os.path.normcase(os.path.join(os.path.dirname(__file__), 'bazarr/main.py'))] + globals()['arguments'] pidfile = os.path.normcase(os.path.join(os.path.dirname(__file__), 'bazarr.pid')) - if os.path.exists(pidfile): - logging.error("Bazarr already running, please stop it first.") + ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT) + try: + file = open(pidfile,'w') + except: + logging.error("Error trying to write pid file.") else: - ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT) - try: - file = open(pidfile,'w') - except: - logging.error("Error trying to write pid file.") - else: - file.write(str(ep.pid)) - file.close() - logging.info("Bazarr starting with process id: " + str(ep.pid) + "...") - for line in iter(ep.stdout.readline, ''): - sys.stdout.write(line) + file.write(str(ep.pid)) + file.close() + logging.info("Bazarr starting with process id: " + str(ep.pid) + "...") + for line in iter(ep.stdout.readline, ''): + sys.stdout.write(line) def shutdown_bazarr(restarting): |