A
A
Alexander2014-11-13 11:10:15
PHP
Alexander, 2014-11-13 11:10:15

How to reload a service in ubuntu via web?

The very meaning is that you need to click on the button from the web page, after which the nagios3 service will be updated and the new settings will take effect (new hosts will be added).
The command was launched via php shell_exec ('service nagios3 reload'), it does not write enough rights, I assigned rights 777 to the nagios directory, the user from which the execution is being entered into the root, adm, www-data groups, but all the same. A method like logging in from the web as root shell_exec('sudo su root') and then executing the command doesn't work either. Maybe there is another solution?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
yarofon, 2014-11-13
@yarofon

You have weird body movements. The task is to allow the user (in this case, the web server) to restart the service. Try what is written here

A
Alexander, 2014-11-14
@vanterbit

I tried the above method, + a similar situation is described here , but it did not help. It starts from the command line, but not from the web.
The solution turned out to be a couple of lines:
we add in it:

www-data  ALL=(ALL:ALL) ALL
www-data ALL=(root) NOPASSWD:  /etc/init.d/nagios3 reload

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question