I have a very simple question: How to start / stop a systemd service from a .NET 6.0 Console App? Just to clarify: I do not want the service to stop itself. I want a console app to stop another service already installed on a Ubuntu Server 20.04.
More concrete: How would I call this line in C# properly?
sudo systemctl start SERVICE_NAME
Do I have to start a Process like this?
var process = new Process();
process.StartInfo.FileName = " /usr/lib/systemd"
process.StartInfo.Arguments = "start SERVICENAME";
process.Start();
What have I tried so far?
I googled but could not find any viable solution, and since I am no expert on Linux I might have fallen into the XY trap