fix: sudo linux信息

This commit is contained in:
caiyuchao
2025-04-17 11:41:00 +08:00
parent c651f4169f
commit 960fb64fc3

View File

@@ -48,7 +48,7 @@ public class LinuxServerInfos extends AbstractServerInfos {
String serialNumber = "";
//使用dmidecode命令获取CPU序列号
String[] shell = {"/bin/bash", "-c", "dmidecode -t processor | grep 'ID' | awk -F ':' '{print $2}' | head -n 1"};
String[] shell = {"/bin/bash", "-c", "sudo dmidecode -t processor | grep 'ID' | awk -F ':' '{print $2}' | head -n 1"};
Process process = Runtime.getRuntime().exec(shell);
process.getOutputStream().close();
@@ -69,7 +69,7 @@ public class LinuxServerInfos extends AbstractServerInfos {
String serialNumber = "";
//使用dmidecode命令获取主板序列号
String[] shell = {"/bin/bash", "-c", "dmidecode | grep 'Serial Number' | awk -F ':' '{print $2}' | head -n 1"};
String[] shell = {"/bin/bash", "-c", "sudo dmidecode | grep 'Serial Number' | awk -F ':' '{print $2}' | head -n 1"};
Process process = Runtime.getRuntime().exec(shell);
process.getOutputStream().close();