From b1cb60549f335a9b01a98473348764404849f764 Mon Sep 17 00:00:00 2001 From: Noe Date: Tue, 19 Mar 2024 17:45:52 +0100 Subject: [PATCH] update firmware on backend --- csharp/App/Backend/Controller.cs | 1 - csharp/App/Backend/DataTypes/Methods/Session.cs | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/csharp/App/Backend/Controller.cs b/csharp/App/Backend/Controller.cs index 3755d0146..78a6f719b 100644 --- a/csharp/App/Backend/Controller.cs +++ b/csharp/App/Backend/Controller.cs @@ -518,7 +518,6 @@ public class Controller : ControllerBase { var session = Db.GetSession(authToken); var installationToUpdate = Db.GetInstallationById(installationId); - Console.WriteLine("Inside firmware function controller,batteryNode="+batteryNode+ "and installation is "+installationId); if (installationToUpdate != null) { diff --git a/csharp/App/Backend/DataTypes/Methods/Session.cs b/csharp/App/Backend/DataTypes/Methods/Session.cs index 8fa5c893a..264338643 100644 --- a/csharp/App/Backend/DataTypes/Methods/Session.cs +++ b/csharp/App/Backend/DataTypes/Methods/Session.cs @@ -70,23 +70,23 @@ public static class SessionMethods public static async Task RunScriptInBackground(this Session? session, String vpnIp, Int64 batteryNode) { - Console.WriteLine("11111111111111111111111111111111111111111111111111111111111111"); + Console.WriteLine("-----------------------------------Start updating firmware-----------------------------------"); string scriptPath = "/home/ubuntu/backend/uploadBatteryFw/update_firmware.sh"; await Task.Run(() => { Process process = new Process(); process.StartInfo.FileName = "/bin/bash"; - process.StartInfo.Arguments = $"{scriptPath} {vpnIp} {batteryNode}"; // Pass batteryNode as argument to the script + process.StartInfo.Arguments = $"{scriptPath} {vpnIp} {batteryNode}"; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); string output = process.StandardOutput.ReadToEnd(); - process.WaitForExit(); // This can be removed if you don't need to wait for the process to finish + process.WaitForExit(); Console.WriteLine(output); }); - Console.WriteLine("222222222222222222222222222222222222222222222222222222222222222"); + Console.WriteLine("-----------------------------------Stop updating firmware-----------------------------------"); }