Rocket Rocket - 7 months ago 36
Linux Question

Linux run php script on boot

openSuSE 13.2 when it's finished starting up I want to automatically run a php script and keep it running in the background. The script is a loop that never ends.. so once launched it shouldn't stop.

It doesn't need to write out any information to screen it will take care of that and generate it's own log file and emails as needed.

In the past I've used the following with bash scripts, but it doesn't work for php. I don't see this as a duplicate question as they relate to bash scripts etc NOT PHP.

- cp <yourscriptname> /etc/init.d/
- insserv <yourscriptname>

chkconfig --list | grep <yourscriptname>

Can anyone advise the best way to do this.



You can make your php script executable. The way is to add #!/usr/bin/php (or whatever your php path is) to the top of the script, and then chmod +x <script>

Then your original solution should work