I am making a tool that is interacting with NAGIOS where some config files should be added so a restart will be needed.
What I need to know is how to restart NAGIOS using PHP code since this tool is written in PHP .. when I try to do this using:
shell_exec("service nagios restart");
changes do not take place but when I do this manually by the console all changes I did using the PHP script are applied ... after 2 minutes research I found that I am asking linux to execut this command while I am logged in as apache user so I changed the command to:
shell_exec('echo "mypass" | sudo -S service nagios restart');
still having the same problem ... new config files are not read until I restart manually
any suggestions will be appreciated :)