排除linux下无关分区
Some checks failed
Compile / build (x64, windows-latest) (push) Failing after 14s
Compile / build (x64, ubuntu-latest) (push) Failing after 12m41s

This commit is contained in:
远野千束 2024-10-03 17:38:10 +08:00
parent 89d7fa3145
commit db7aeabe7b
2 changed files with 9 additions and 0 deletions

View File

@ -90,6 +90,9 @@ sudo systemctl start server-status-client
```shell
git pull
sudo systemctl restart server-status-client
#
git pull
systemctl restart server-status-client
```
### 服务端

View File

@ -6,6 +6,8 @@ from typing import Any
import psutil
import requests
excluded_partition_prefix = ("/var", "/boot", "/run", "/proc", "/sys", "/dev", "/tmp", "/snap")
def log(*args):
# 在输出前加上时间
@ -229,6 +231,10 @@ class Client:
for part in psutil.disk_partitions():
try:
usage = psutil.disk_usage(part.mountpoint)
if part.mountpoint.startswith(excluded_partition_prefix):
continue
self.hardware.disks[part.device] = {
"total": usage.total,
"used": usage.used,