I have a php console app and an Ubuntu server. I'm executing the app with this basic command:
php app.php
I want to execute it repetitively, but cronjobs is not suitable for me. Instead, I want it to execute such that when app.php finishes working it will be executed again immediately (like an infinity loop), rather than being executed again every X minutes.
So I made this bash script:
while true; do
php app.php
done
this solves my problem, but the usage of while true
seems evil. Is it possible to stop this bash script, if necessary? Or can you tell me a better way to do this?
(app.php file , fetches a long list of website URLs and their content. It's like a web spider. I connect to the server via ssh , execute bash script with nohup, and then close terminal. )