create function sendNotification
This commit is contained in:
		
							parent
							
								
									6e2ccd96a7
								
							
						
					
					
						commit
						8318b0598f
					
				| 
						 | 
				
			
			@ -11,8 +11,9 @@ const sendNotification = async () => {
 | 
			
		|||
      realm: "https://zulip.ipsupply.com.au",
 | 
			
		||||
    };
 | 
			
		||||
    const client = await zulip(config);
 | 
			
		||||
    const command = "nc -zv 172.16.7.13 8002"
 | 
			
		||||
 | 
			
		||||
    let auto1 = ""
 | 
			
		||||
    let auto2 = ""
 | 
			
		||||
    let log = ""
 | 
			
		||||
    // let autoStatus = process.argv[2].includes("succeeded") && process.argv[3].includes("succeeded")
 | 
			
		||||
    //   ? ":check:"
 | 
			
		||||
    //   : ":red_circle:";
 | 
			
		||||
| 
						 | 
				
			
			@ -20,17 +21,52 @@ const sendNotification = async () => {
 | 
			
		|||
    //   ? ":check:"
 | 
			
		||||
    //   : ":red_circle:";
 | 
			
		||||
 | 
			
		||||
      exec(command, (error, stdout, stderr) => {
 | 
			
		||||
      exec("nc -zv 172.16.7.13 8002", (error, stdout, stderr) => {
 | 
			
		||||
        if (error) {
 | 
			
		||||
          console.error(`Error executing command: ${error.message}`);
 | 
			
		||||
        //   console.error(`Error executing command: ${error.message}`);
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
  
 | 
			
		||||
        console.log(`Command output:\n${stdout}`);
 | 
			
		||||
        console.log(`Command output:\n${stderr}`);
 | 
			
		||||
        if(stdout !== ""){
 | 
			
		||||
            auto1 += stdout
 | 
			
		||||
        }else{
 | 
			
		||||
            auto1 += stderr
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      exec("nc -zv 172.16.7.13 5000", (error, stdout, stderr) => {
 | 
			
		||||
        if (error) {
 | 
			
		||||
        //   console.error(`Error executing command: ${error.message}`);
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
  
 | 
			
		||||
        if(stdout !== ""){
 | 
			
		||||
            auto2 += stdout
 | 
			
		||||
        }else{
 | 
			
		||||
            auto2 += stderr
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      exec("nc -zv 172.16.6.23 3333", (error, stdout, stderr) => {
 | 
			
		||||
        if (error) {
 | 
			
		||||
        //   console.error(`Error executing command: ${error.message}`);
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
  
 | 
			
		||||
        if(stdout !== ""){
 | 
			
		||||
            log += stdout
 | 
			
		||||
        }else{
 | 
			
		||||
            log += stderr
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      setTimeout(() => {
 | 
			
		||||
        console.log({auto1:auto1, auto2: auto2, log:log})
 | 
			
		||||
      }, 3000);
 | 
			
		||||
 | 
			
		||||
    // let time = moment(Date.now()).format("HH:mm - DD/MM")
 | 
			
		||||
    // let content =
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue