From e2ef1056e930e854e09d60efa62f0e88baad78b8 Mon Sep 17 00:00:00 2001 From: jayman2000 Date: Thu, 30 Jun 2016 09:41:21 -0400 Subject: [PATCH 1/2] settings file now looked for in the directory where the script is, rather than $PWD settings.py now looks for the settings file in and writes the log file to the directory where eth-proxy lives rather than $PWD --- stratum/settings.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stratum/settings.py b/stratum/settings.py index fd7fad8..8f3cc3a 100644 --- a/stratum/settings.py +++ b/stratum/settings.py @@ -35,14 +35,14 @@ def read_values(cfg): yield (varname, value) import config_default + import sys - if os.path.isfile('eth-proxy.conf'): - config = open('eth-proxy.conf','r').readlines() + if os.path.isfile(sys.path[0]+'/eth-proxy.conf'): + config = open(sys.path[0]+'/eth-proxy.conf','r').readlines() else: # Custom config not presented, but we can still use defaults config = None - import sys module = sys.modules[__name__] for name,value in read_values(config_default): @@ -56,8 +56,8 @@ def read_values(cfg): changes["LOGLEVEL"] = "DEBUG" module.__dict__["LOGLEVEL"] = "DEBUG" if name=="LOG_TO_FILE" and value: - changes["LOGFILE"] = "proxy.log" - module.__dict__["LOGFILE"] = "proxy.log" + changes["LOGFILE"] = sys.path[0]+"proxy.log" + module.__dict__["LOGFILE"] = sys.path[0]+"proxy.log" changes[name] = value module.__dict__[name] = value From 25002bcf5d5a8caec78b2c69967d2d9cdcac50bf Mon Sep 17 00:00:00 2001 From: jayman2000 Date: Thu, 30 Jun 2016 09:51:42 -0400 Subject: [PATCH 2/2] eth-proxy.pid is now writen to the directory where eth-proxy.py is, rather than to $PWD --- eth-proxy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth-proxy.py b/eth-proxy.py index 1fbe785..bfd3508 100644 --- a/eth-proxy.py +++ b/eth-proxy.py @@ -166,7 +166,7 @@ def main(): log.warning("-----------------------------------------------------------------------") if __name__ == '__main__': - fp = file("eth-proxy.pid", 'w') + fp = file(sys.path[0]+"eth-proxy.pid", 'w') fp.write(str(os.getpid())) fp.close() main()