How to restart an application in C++ programatically?
I currently use a systemd service and call it with the system()
function like this:
std::string restartCommand = "sudo systemctl restart MyService";
system(restartCommand.c_str());
Is this an acceptable way to achieve a restart?
New contributor
monkeyCoding06 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1