]> git.gsnw.org Git - raspbmirror.git/commitdiff
Add logrotate by date
authorGerman Service Network <support@gsnw.de>
Sun, 19 Jul 2020 08:23:38 +0000 (10:23 +0200)
committerGerman Service Network <support@gsnw.de>
Sun, 19 Jul 2020 08:23:38 +0000 (10:23 +0200)
raspbmirror.py

index 29cff7830746cfd0beff37937e7f4cf52a626ff8..7ce4e0c94d8e0fdf0cf78ac839650be898e1561e 100644 (file)
@@ -46,8 +46,9 @@ args = parser.parse_args()
 lockfd = os.open('.',os.O_RDONLY)
 fcntl.flock(lockfd,fcntl.LOCK_EX | fcntl.LOCK_NB)
 
+dtNow = datetime.now()
 logpath = os.path.dirname(os.path.realpath(__file__))
-logging.basicConfig(filename=logpath+'/raspbmirror.log',format='%(asctime)s %(levelname)s: %(message)s', level=logging.DEBUG)
+logging.basicConfig(filename=logpath+'/'+dtNow.strftime("%Y-%m-%d")+'_raspbmirror.log',format='%(asctime)s %(levelname)s: %(message)s', level=logging.DEBUG)
 
 def addfilefromdebarchive(filestoverify,filequeue,filename,sha256,size):
        size = int(size)