Update README with common commands and add hidden process control functions in Worker
This commit is contained in:
@@ -99,9 +99,13 @@ This file provides a C# wrapper for the NVIDIA Management Library (NVML) functio
|
|||||||
Feel free to contribute by opening issues or submitting pull requests. Make sure to follow the project's coding style and best practices.
|
Feel free to contribute by opening issues or submitting pull requests. Make sure to follow the project's coding style and best practices.
|
||||||
|
|
||||||
|
|
||||||
# devnote
|
## devnote
|
||||||
dotnet run
|
- **Commonlly use command**:
|
||||||
git add .
|
- dotnet run
|
||||||
git commit -m "Add steam running games"
|
- git add .
|
||||||
git push origin master
|
- git commit -m "Add steam running games"
|
||||||
dotnet publish -c Release -o ./publish
|
- git push origin master
|
||||||
|
- dotnet publish -c Release -o ./publish
|
||||||
|
|
||||||
|
- **Using git bash**:
|
||||||
|
- curl -X POST "http://localhost:5000/api/kill-process" -H "Content-Type: application/json" -d '3333333'
|
||||||
@@ -66,6 +66,28 @@ namespace ResourceMonitorService
|
|||||||
var idStr = await new StreamReader(context.Request.Body).ReadToEndAsync();
|
var idStr = await new StreamReader(context.Request.Body).ReadToEndAsync();
|
||||||
int processId = Convert.ToInt32(idStr);
|
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();
|
Process[] processes = Process.GetProcesses().Where(p => p.Id == processId).ToArray();
|
||||||
|
|
||||||
if (processes.Length > 0)
|
if (processes.Length > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user