Update firmware on backend

This commit is contained in:
Noe 2024-03-19 17:43:00 +01:00
parent ce12d6a59a
commit 2851e34e47
1 changed files with 7 additions and 5 deletions

View File

@ -2,6 +2,7 @@ using System.Diagnostics;
using InnovEnergy.App.Backend.Database;
using InnovEnergy.App.Backend.Relations;
using InnovEnergy.Lib.Utils;
using Org.BouncyCastle.Asn1.X509;
namespace InnovEnergy.App.Backend.DataTypes.Methods;
@ -67,8 +68,9 @@ public static class SessionMethods
.Apply(Db.Update);
}
public static async Task<Boolean> RunScriptInBackground(this Session? session, String vpnIp, Int64 batteryNode)
public static async Task RunScriptInBackground(this Session? session, String vpnIp, Int64 batteryNode)
{
Console.WriteLine("11111111111111111111111111111111111111111111111111111111111111");
string scriptPath = "/home/ubuntu/backend/uploadBatteryFw/update_firmware.sh";
await Task.Run(() =>
@ -80,11 +82,11 @@ public static class SessionMethods
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
Console.WriteLine(output);
});
return true;
Console.WriteLine("222222222222222222222222222222222222222222222222222222222222222");
}