feat: Uncomment code to allow backend to send disk space information to frontend

pull/22/head
adriano 2024-02-08 09:13:19 -03:00
parent 7bab4bf6b9
commit c444012963
1 changed files with 23 additions and 23 deletions

View File

@ -90,33 +90,33 @@ const monitor = async () => {
}
// exec("df -h /", (error: any, stdout: any, stderr: any) => {
exec("df -h /", (error: any, stdout: any, stderr: any) => {
// if (error) {
// console.log(`exec error: ${error.message}`);
// return;
// }
// if (stderr) {
// console.log(`exec stderr: ${stderr}`);
// return;
// }
if (error) {
console.log(`exec error: ${error.message}`);
return;
}
if (stderr) {
console.log(`exec stderr: ${stderr}`);
return;
}
// stdout = stdout.split(/\r?\n/)
// stdout = stdout[1].trim().split(/\s+/)
stdout = stdout.split(/\r?\n/)
stdout = stdout[1].trim().split(/\s+/)
// // DISK SPACE MONITORING
// const io = getIO();
// io.emit("diskSpaceMonit", {
// action: "update",
// diskSpace: {
// size: stdout[1],
// used: stdout[2],
// available: stdout[3],
// use: stdout[4]
// }
// });
// DISK SPACE MONITORING
const io = getIO();
io.emit("diskSpaceMonit", {
action: "update",
diskSpace: {
size: stdout[1],
used: stdout[2],
available: stdout[3],
use: stdout[4]
}
});
// });
});