17 lines
361 B
Python
17 lines
361 B
Python
# coding=utf-8
|
|
|
|
import os
|
|
|
|
def main():
|
|
process = os.popen("df | sed -n '5, 0p' | awk '{print $2, $3}'")
|
|
res = process.read()
|
|
process.close()
|
|
(total, used) = res.split(' ')
|
|
total = int(total)
|
|
used = int(used)
|
|
percent = used * 100 / total
|
|
if percent < 85:
|
|
return
|
|
|
|
print("Warning: disk usage is {:.2f}".foramt(percent))
|