From dc33db50e88d7e7b126bb3d6977f74e40027e018 Mon Sep 17 00:00:00 2001 From: Johan Date: Sun, 12 Jun 2016 07:47:01 +1000 Subject: [PATCH 1/3] Update eth-proxy.py with relative file locations updated with relative file locations in order to start eth-proxy from anywhere --- eth-proxy.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eth-proxy.py b/eth-proxy.py index 1fbe785..2859a96 100644 --- a/eth-proxy.py +++ b/eth-proxy.py @@ -31,8 +31,8 @@ def on_shutdown(f): '''Clean environment properly''' log.info("Shutting down proxy...") - if os.path.isfile('eth-proxy.pid'): - os.remove('eth-proxy.pid') + if os.path.isfile(os.path.join(os.path.dirname(__file__), '../', 'eth-proxy.pid')): + os.remove(os.path.join(os.path.dirname(__file__), '../', 'eth-proxy.pid')) f.is_reconnecting = False # Don't let stratum factory to reconnect again # Support main connection @@ -166,7 +166,7 @@ def main(): log.warning("-----------------------------------------------------------------------") if __name__ == '__main__': - fp = file("eth-proxy.pid", 'w') + fp = file(os.path.join(os.path.dirname(__file__), '../', 'eth-proxy.pid'), 'w') fp.write(str(os.getpid())) fp.close() main() From 3ca10fef0a52e51404b321a3c6b19af34f08be46 Mon Sep 17 00:00:00 2001 From: Johan Date: Sun, 12 Jun 2016 07:49:27 +1000 Subject: [PATCH 2/3] Update config_default.py relative file locations updated with relative file locations in order to start eth-proxy from anywhere --- stratum/config_default.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stratum/config_default.py b/stratum/config_default.py index 678b232..17b31e7 100644 --- a/stratum/config_default.py +++ b/stratum/config_default.py @@ -2,6 +2,7 @@ This is example configuration for Stratum server. Please rename it to config.py and fill correct values. ''' +import os # ******************** GENERAL SETTINGS *************** @@ -9,7 +10,7 @@ DEBUG = False # Destination for application logs, files rotated once per day. -LOGDIR = 'log/' +LOGDIR = os.path.join(os.path.dirname(__file__), '../log/') # Main application log file. LOGFILE = None From fc46b047ad855bbac57829cbd490f49f01c55fe0 Mon Sep 17 00:00:00 2001 From: Johan Date: Sun, 12 Jun 2016 07:51:28 +1000 Subject: [PATCH 3/3] Update settings.py with relative file locations updated with relative file locations in order to start eth-proxy from anywhere --- stratum/settings.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stratum/settings.py b/stratum/settings.py index fd7fad8..a37110f 100644 --- a/stratum/settings.py +++ b/stratum/settings.py @@ -36,8 +36,10 @@ def read_values(cfg): import config_default - if os.path.isfile('eth-proxy.conf'): - config = open('eth-proxy.conf','r').readlines() + conf_file = os.path.join(os.path.dirname(__file__), '../', 'eth-proxy.conf') + + if os.path.isfile(conf_file): + config = open(conf_file,'r').readlines() else: # Custom config not presented, but we can still use defaults config = None