added modes to mkdir's, some todos

master
agp8x 2014-08-07 11:50:12 +02:00
parent a6f3e5618f
commit 375315d0f4
5 changed files with 7 additions and 6 deletions

View File

@ -36,6 +36,7 @@ class Logger(object):
# common function to write value to file # # common function to write value to file #
########################################## ##########################################
def write_value(self,value,sensor): def write_value(self,value,sensor):
# TODO: catch IOError
valuename=self.records+"/"+self.names[sensor]+"_"+preptime() valuename=self.records+"/"+self.names[sensor]+"_"+preptime()
valuelog=open(valuename,'a') valuelog=open(valuename,'a')
valuelog.write(str(value) + ';' + str(int(time.time())) +"\n") valuelog.write(str(value) + ';' + str(int(time.time())) +"\n")

6
all.py
View File

@ -24,7 +24,7 @@ import settings
def check_dirs_and_files(): def check_dirs_and_files():
# log # log
if not os.path.exists(settings.logs): if not os.path.exists(settings.logs):
os.mkdir(settings.logs) os.mkdir(settings.logs, 0000755)
if not os.path.exists(settings.logname): if not os.path.exists(settings.logname):
open(settings.logname, 'w').close() open(settings.logname, 'w').close()
if not os.path.exists(settings.exceptionlog): if not os.path.exists(settings.exceptionlog):
@ -33,10 +33,10 @@ def check_dirs_and_files():
file.close() file.close()
# lock # lock
if not os.path.exists(settings.locks): if not os.path.exists(settings.locks):
os.mkdir(settings.locks) os.mkdir(settings.locks, 0000755)
# records # records
if not os.path.exists(settings.records): if not os.path.exists(settings.records):
os.mkdir(settings.records) os.mkdir(settings.records, 0000755)
if __name__ == "__main__": if __name__ == "__main__":
check_dirs_and_files() check_dirs_and_files()

View File

@ -1 +0,0 @@
an Exception happen during connection @Tue Jul 22 12:39:27 2014

View File

@ -1 +0,0 @@
<exceptions></exceptions>

View File

@ -5,6 +5,8 @@ import time
import os import os
from timeFunctions import * from timeFunctions import *
# TODO: path from settings
checkfile='locks/records_moved' checkfile='locks/records_moved'
if not os.path.exists(checkfile): if not os.path.exists(checkfile):
@ -30,7 +32,7 @@ else:
log.flush() log.flush()
if not os.path.exists("arch"): if not os.path.exists("arch"):
os.mkdir("arch") os.mkdir("arch")
os.system("./move.sh "+preptime()) os.system("./move.sh "+preptime()) # TODO: replace me with: https://docs.python.org/2/library/shutil.html#module-shutil
check.close() check.close()
check=open(checkfile,'w') check=open(checkfile,'w')
check.write(str(time.time())) check.write(str(time.time()))