I am doing a system maintenance script that is checking the status of various services
(memcached, sphinx, etc)
I would like to start the service from php script if it is down…
I managed to do it for memcache like this:
$command = 'memcached -d -m 800 -l 127.0.0.1 -p 11211 -u root start';
$dummy = system($command, $retval);
it is working GREAT…
now I’d like to do the same thing for SphinxSearch service
I tried
$command = 'service searchd start';
but got no result… and I read that I need sudo for this, so I did
$command = 'sudo service searchd start';
and even
$command = '/usr/bin/sudo /usr/bin/searchd';
but nothing worked.
Any suggestions?
Try using