Fix the reboot process in IPMonitor
All checks were successful
Build .NET Project / build (push) Successful in 4m51s

This commit is contained in:
2025-12-20 18:47:07 -05:00
parent d9c6d9da0a
commit a82da5bc77

View File

@@ -46,7 +46,13 @@ namespace IPMonitor
MDTrace.WriteLine(LogLevel.DEBUG,$"[RunService] Argument {arg}");
bool force=false;
if(commandArgs.Has("FORCE"))
if(commandArgs.Has("REBOOT") && true==commandArgs.Coalesce<bool>("REBOOT"))
{
MDTrace.WriteLine(LogLevel.DEBUG,"IPMONITOR REBOOT true.");
Reboot();
return;
}
else if(commandArgs.Has("FORCE"))
{
force=commandArgs.Coalesce<bool>("FORCE");
MDTrace.WriteLine(LogLevel.DEBUG,$"FORCE={force}");
@@ -86,8 +92,8 @@ namespace IPMonitor
}
/// <summary>
/// Verified that we are connected to the internet.00000000
/// Tghe method will retry for 5 minutes and then issue a reboot
/// Verified that we are connected to the internet.
/// The method will retry for 5 minutes and then issue a reboot
/// </summary>
public static void VerifyNetwork()
{
@@ -115,7 +121,7 @@ namespace IPMonitor
if(!isNetworkAvailable)
{
MDTrace.WriteLine(LogLevel.DEBUG,$"IPMonitor has determined that the network has been down for {(TIMEOUT_BETWEEN_ATTEMPTS*MAX_RETRIES)/60000} minutes, rebooting");
Utility.Reboot();
Reboot();
}
}
catch(Exception exception)
@@ -126,6 +132,15 @@ namespace IPMonitor
}
}
/// <summary>
/// If REBOOT is specified in the command line arguments then a reboot will be initiated
/// </summary>
public static void Reboot()
{
MDTrace.WriteLine(LogLevel.DEBUG,"Initiating reboot process.");
Utility.Reboot();
}
/// <summary>
/// Retains a record of current ip address in ipaddress.txt file and updates that ip address to ZoneEdit for DNS
/// </summary>