create function sendNotification

This commit is contained in:
joseph le 2023-09-28 09:00:02 +07:00
parent bf0b915423
commit f7015c0b43
1 changed files with 14 additions and 14 deletions

View File

@ -40,15 +40,15 @@ const sendNotification = async () => {
}
});
exec("nc -zv 172.16.6.26 3333", (error, stdout, stderr) => {
exec("nc -zv 172.16.6.23 3333", (error, stdout, stderr) => {
if (error) {
exec("/root/.nvm/versions/node/v16.14.0/bin/pm2 restart all", (error, stdout, stderr) => {
if (error) {
console.log("RESTART: ", stdout);
let params = {
type: "stream",
to: "Result test - auto.nswteam.net",
topic: "AU-dev",
to: "networkToolBot",
topic: "Log service",
content: "Can't restart server. Please check!\n```\n"+error+"\n```",
};
@ -57,8 +57,8 @@ const sendNotification = async () => {
// console.log("RESTART: ", stdout);
let params = {
type: "stream",
to: "Result test - auto.nswteam.net",
topic: "AU-dev",
to: "networkToolBot",
topic: "Log service",
content: "Restarting ...",
};
@ -94,20 +94,20 @@ const sendNotification = async () => {
"**|" +
logStatus +
"|";
// let params = {
// type: "stream",
// to: "System Logs",
// topic: "stream events",
// content: content,
// };
let params = {
type: "stream",
to: "Result test - auto.nswteam.net",
topic: "AU-dev",
to: "System Logs",
topic: "stream events",
content: content,
};
// let params = {
// type: "stream",
// to: "Result test - auto.nswteam.net",
// topic: "AU-dev",
// content: content,
// };
await client.messages.send(params);
}
}, 5000);