From a82da5bc77a3a64ca3470699dd8ac9bbcb232a2d Mon Sep 17 00:00:00 2001 From: Sean Date: Sat, 20 Dec 2025 18:47:07 -0500 Subject: [PATCH] Fix the reboot process in IPMonitor --- IPMonitor/Services/MainService.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/IPMonitor/Services/MainService.cs b/IPMonitor/Services/MainService.cs index 459d563..aee6fae 100755 --- a/IPMonitor/Services/MainService.cs +++ b/IPMonitor/Services/MainService.cs @@ -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("REBOOT")) + { + MDTrace.WriteLine(LogLevel.DEBUG,"IPMONITOR REBOOT true."); + Reboot(); + return; + } + else if(commandArgs.Has("FORCE")) { force=commandArgs.Coalesce("FORCE"); MDTrace.WriteLine(LogLevel.DEBUG,$"FORCE={force}"); @@ -86,8 +92,8 @@ namespace IPMonitor } /// - /// 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 /// 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 } } + /// + /// If REBOOT is specified in the command line arguments then a reboot will be initiated + /// + public static void Reboot() + { + MDTrace.WriteLine(LogLevel.DEBUG,"Initiating reboot process."); + Utility.Reboot(); + } + /// /// Retains a record of current ip address in ipaddress.txt file and updates that ip address to ZoneEdit for DNS ///