Created
August 24, 2016 23:34
-
-
Save bwangelme/308150b88a687dadd99709be201d69b2 to your computer and use it in GitHub Desktop.
set log name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import os | |
LOG_BASE_NAME = 'snmp_info.log' | |
INDEX = 0 | |
while True: | |
LOG_NAME = LOG_BASE_NAME + ("." + str(INDEX) if INDEX else '') | |
if not os.path.exists(LOG_NAME): | |
break | |
else: | |
INDEX+=1 | |
with open(LOG_NAME, 'w+') as f: | |
f.write(LOG_NAME) | |
print("%s:%sB" % (LOG_NAME, os.stat(LOG_NAME).st_size)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment