added modes to mkdir's, some todos
parent
a6f3e5618f
commit
375315d0f4
|
|
@ -36,6 +36,7 @@ class Logger(object):
|
|||
# common function to write value to file #
|
||||
##########################################
|
||||
def write_value(self,value,sensor):
|
||||
# TODO: catch IOError
|
||||
valuename=self.records+"/"+self.names[sensor]+"_"+preptime()
|
||||
valuelog=open(valuename,'a')
|
||||
valuelog.write(str(value) + ';' + str(int(time.time())) +"\n")
|
||||
|
|
|
|||
6
all.py
6
all.py
|
|
@ -24,7 +24,7 @@ import settings
|
|||
def check_dirs_and_files():
|
||||
# log
|
||||
if not os.path.exists(settings.logs):
|
||||
os.mkdir(settings.logs)
|
||||
os.mkdir(settings.logs, 0000755)
|
||||
if not os.path.exists(settings.logname):
|
||||
open(settings.logname, 'w').close()
|
||||
if not os.path.exists(settings.exceptionlog):
|
||||
|
|
@ -33,10 +33,10 @@ def check_dirs_and_files():
|
|||
file.close()
|
||||
# lock
|
||||
if not os.path.exists(settings.locks):
|
||||
os.mkdir(settings.locks)
|
||||
os.mkdir(settings.locks, 0000755)
|
||||
# records
|
||||
if not os.path.exists(settings.records):
|
||||
os.mkdir(settings.records)
|
||||
os.mkdir(settings.records, 0000755)
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_dirs_and_files()
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
an Exception happen during connection @Tue Jul 22 12:39:27 2014
|
||||
|
|
@ -1 +0,0 @@
|
|||
<exceptions></exceptions>
|
||||
4
move.py
4
move.py
|
|
@ -5,6 +5,8 @@ import time
|
|||
import os
|
||||
from timeFunctions import *
|
||||
|
||||
# TODO: path from settings
|
||||
|
||||
checkfile='locks/records_moved'
|
||||
|
||||
if not os.path.exists(checkfile):
|
||||
|
|
@ -30,7 +32,7 @@ else:
|
|||
log.flush()
|
||||
if not os.path.exists("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=open(checkfile,'w')
|
||||
check.write(str(time.time()))
|
||||
|
|
|
|||
Loading…
Reference in New Issue