TrzasQ TrzasQ - 1 year ago 78
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download