I want to be able to stop/start a daemon (on Debian) by clicking a button on a website. I know the daemon works, because via SSH it does start and stop. I can even capture the status with
$status = exec("/etc/init.d/MyService.sh status | grep 'is running'");
But this doesn't work:
exec('/etc/init.d/MyService.sh start', $output);
There I get this error: Starting system MyService daemon: failed! I guess it has to do with permissions but I don't know how. The permissions of the .pid file is -rwxrw-rw-
I read this https://mcmap.net/q/1916902/-use-php-to-start-restart-process and this Starting a daemon from PHP but both didn't help either.
Any ideas?
Thanks
chmod +x
and try again – Okeefe