Fix the reboot process in IPMonitor
All checks were successful
Build .NET Project / build (push) Successful in 4m51s
All checks were successful
Build .NET Project / build (push) Successful in 4m51s
This commit is contained in:
@@ -46,7 +46,13 @@ namespace IPMonitor
|
|||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"[RunService] Argument {arg}");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"[RunService] Argument {arg}");
|
||||||
|
|
||||||
bool force=false;
|
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");
|
force=commandArgs.Coalesce<bool>("FORCE");
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"FORCE={force}");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"FORCE={force}");
|
||||||
@@ -86,8 +92,8 @@ namespace IPMonitor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Verified that we are connected to the internet.00000000
|
/// Verified that we are connected to the internet.
|
||||||
/// Tghe method will retry for 5 minutes and then issue a reboot
|
/// The method will retry for 5 minutes and then issue a reboot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void VerifyNetwork()
|
public static void VerifyNetwork()
|
||||||
{
|
{
|
||||||
@@ -115,7 +121,7 @@ namespace IPMonitor
|
|||||||
if(!isNetworkAvailable)
|
if(!isNetworkAvailable)
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"IPMonitor has determined that the network has been down for {(TIMEOUT_BETWEEN_ATTEMPTS*MAX_RETRIES)/60000} minutes, rebooting");
|
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)
|
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>
|
/// <summary>
|
||||||
/// Retains a record of current ip address in ipaddress.txt file and updates that ip address to ZoneEdit for DNS
|
/// Retains a record of current ip address in ipaddress.txt file and updates that ip address to ZoneEdit for DNS
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user