Files
agnos-builder/userspace/usr/comma/varwatch.py
T
Adeeb Shihadeh f3f6287709 Fix /var/ filling up once and for all (#451)
* 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
2025-02-03 19:20:34 -08:00

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)