Mise à jour de 'update-motd.d/sysinfo.py'

This commit is contained in:
Dryusdan 2021-04-26 17:59:08 +02:00
parent c30b7d8596
commit 2f173f845d
1 changed files with 7 additions and 4 deletions

View File

@ -41,6 +41,7 @@ def proc_mount():
for m in open('/proc/mounts').readlines():
a = m.split()
if a[0].find('/dev/') is 0:
if a[0].find('/dev/') is 0:
statfs = os.statvfs(a[1])
perc = 100-100.*statfs.f_bavail/statfs.f_blocks
gb = statfs.f_bsize*statfs.f_blocks/1024./1024/1024
@ -52,10 +53,12 @@ def inode_proc_mount():
for m in open('/proc/mounts').readlines():
a = m.split()
if a[0].find('/dev/') is 0:
statfs = os.statvfs(a[1])
perc = 100-100.*statfs.f_ffree/statfs.f_files
iTotal = statfs.f_files
items[a[1]] = "%.1f%% of %.2d" % (perc, iTotal)
# In case of vfat (raspberry) boot
if a[1] != "/boot":
statfs = os.statvfs(a[1])
perc = 100-100.*statfs.f_ffree/statfs.f_files
iTotal = statfs.f_files
items[a[1]] = "%.1f%% of %.2d" % (perc, iTotal)
return items
loadav = float(open("/proc/loadavg").read().split()[1])