I want to run a command like sudo systemctl restart mongod in a script without it prompting for a password since the script wont be able to enter it.
I’ve been trying to edit the visudo file to allow specific commands to run without password prompt, but can’t seem to figure out exactly what setting I need to enter to get that to work.
Also there’s seems to be numerous ways to start/stop the mongo instance like: service mongod start, systemctl start mongod.service. I’m not sure what’s the difference between them.