From 715351ace262cdea2663dfaaa8225df498489be2 Mon Sep 17 00:00:00 2001 From: joseph le Date: Sun, 12 Nov 2023 10:23:06 +0700 Subject: [PATCH] last commit --- netmiko_socket/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netmiko_socket/index.js b/netmiko_socket/index.js index 41b66d7..2fa730e 100644 --- a/netmiko_socket/index.js +++ b/netmiko_socket/index.js @@ -713,6 +713,8 @@ io.on("connection", (socket) => { // if (data.result[0].status.toLocaleLowerCase() === "error") { // } + + let nameFile = moment(Date.now()).format("YYYYMMDD") + "-AUTO-Session." + data.result[0].sta_name.replace(" ", "-") + ".log" fs.access( "../netmiko_Api/public/dailyLogs/" + moment(Date.now()).format("YYYYMMDD") + @@ -722,8 +724,9 @@ io.on("connection", (socket) => { fs.constants.F_OK, (err) => { if (err) { + //chua co log fs.writeFile( - "../netmiko_Api/public/dailyLogs/" + + "../netmiko_Api/public/dailyLogs/" + moment(Date.now()).format("YYYYMMDD") + "-AUTO-Session." + data.result[0].sta_name.replace(" ", "-") + @@ -740,6 +743,7 @@ io.on("connection", (socket) => { } ); } else { + //da co log const old_data = fs.readFileSync( "../netmiko_Api/public/dailyLogs/" + moment(Date.now()).format("YYYYMMDD") +