mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-07-10 09:12:05 +08:00
f3f6287709
* fix filling up /var/ with journal logs
* Revert "fix filling up /var/ with journal logs"
This reverts commit 5485630fb3.
* can't believe this is still an issue
* and another time bug
* one more
* fix
* revert that
* cleanup
17 lines
473 B
Python
Executable File
17 lines
473 B
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import time
|
|
|
|
if __name__ == "__main__":
|
|
# we are the last line of defense for /var/log filling up
|
|
while True:
|
|
usage = os.statvfs('/var/log')
|
|
percent = (usage.f_blocks - usage.f_bavail) / usage.f_blocks * 100
|
|
if percent > 70:
|
|
for fn in os.listdir('/var/log'):
|
|
file_path = os.path.join('/var/log', fn)
|
|
if os.path.isfile(file_path):
|
|
with open(file_path, 'w'):
|
|
pass
|
|
time.sleep(1)
|