From b930ce5fe9cee5e8671e7792368b4cab1e83a54b Mon Sep 17 00:00:00 2001 From: clamsawd Date: Fri, 6 Nov 2015 17:44:24 +0100 Subject: [PATCH] Forcing to create the configuration file --- ip2e-daemon.py | 19 +++++++------------ ip2e-log.py | 17 ----------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/ip2e-daemon.py b/ip2e-daemon.py index 7416465..8c257ca 100755 --- a/ip2e-daemon.py +++ b/ip2e-daemon.py @@ -55,18 +55,13 @@ if os.path.exists(".ip2e"): if os.path.isfile("ip2e-conf.py"): print ("ip2e-conf.py exists") else: - print ("ip2e-conf.py created") - ip2ecf=open('ip2e-conf.py','w') - ip2ecf.close() - ip2ecf=open('ip2e-conf.py','a') - ip2ecf.write('# sample configuration file of ip2e\n') - ip2ecf.write('\n') - ip2ecf.write('FromEmail="ip2e@daemon"\n') - ip2ecf.write('FromEmailUser="unknown"\n') - ip2ecf.write('FromEmailPass="password-here"\n') - ip2ecf.write('SmtpFromEmail="smtp.email.com"\n') - ip2ecf.write('ToEmail="unknown@email.com"\n') - ip2ecf.close() + ClearScreen() + print ("") + print ("The configuration file doesn't exist") + print ("") + print ("You can create it if you run 'ip2e-config.py'") + print ("") + exit(0) #Check if exists 'current-ip.py' if os.path.isfile("current-ip.py"): diff --git a/ip2e-log.py b/ip2e-log.py index eb9e2aa..5f49d94 100755 --- a/ip2e-log.py +++ b/ip2e-log.py @@ -47,23 +47,6 @@ if not os.path.exists(".ip2e"): if os.path.exists(".ip2e"): os.chdir(".ip2e") -#Check if exists 'ip2e-conf.py' -if os.path.isfile("ip2e-conf.py"): - print ("ip2e-conf.py exists") -else: - print ("ip2e-conf.py created") - ip2ecf=open('ip2e-conf.py','w') - ip2ecf.close() - ip2ecf=open('ip2e-conf.py','a') - ip2ecf.write('# sample configuration file of ip2e\n') - ip2ecf.write('\n') - ip2ecf.write('FromEmail="ip2e@daemon"\n') - ip2ecf.write('FromEmailUser="unknown"\n') - ip2ecf.write('FromEmailPass="password-here"\n') - ip2ecf.write('SmtpFromEmail="smtp.email.com"\n') - ip2ecf.write('ToEmail="unknown@email.com"\n') - ip2ecf.close() - #See the log file if os.path.isfile("ip2e.log"): print ("ip2e.log exists")