TrzasQ TrzasQ - 2 months ago 5x
Linux Question

loop php script in bash

I need to run php cli every second in linux bash.
Below you can find my windows.bat file:

start /b pathTophp.exe pathTo\cycler.php
timeout /t 1
goto loop

Perhaps I can use cron and run this simple script every second but I assume minute is a least interval.

php56 cycler.php

As I know there is no goto in bash and I don't know bash at all. So how can I make this?


you are correct cron can only go to 1 minute interval, try this

while true
 php56 cycler.php
 sleep 1

this will loop until you stop it with ctrl-c