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() 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 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