From c444012963ba430023e52e47acf56da8adbdeaf6 Mon Sep 17 00:00:00 2001 From: adriano Date: Thu, 8 Feb 2024 09:13:19 -0300 Subject: [PATCH] feat: Uncomment code to allow backend to send disk space information to frontend --- .../helpers/SchedulingNotifySendMessage.ts | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/backend/src/helpers/SchedulingNotifySendMessage.ts b/backend/src/helpers/SchedulingNotifySendMessage.ts index 78399d7..3ba8e8c 100644 --- a/backend/src/helpers/SchedulingNotifySendMessage.ts +++ b/backend/src/helpers/SchedulingNotifySendMessage.ts @@ -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] + } + }); - // }); + });