I would like to run a php script every 5 seconds.
That's what I've done :
(essay.sh file)
#!/bin/bash
while :
do
php a_file.php
sleep 5
done
(the php file in a nutshell)
<?php
// sql call
// sql into $json
$file = 'json.txt';
file_put_contents($file, $json);
?>
There is no error when I do: ./essay.sh, but the json.txt is not refreshed (nothing happen, and I've set the rights to 0755 for the both files).
When I use the direct url of a_file.php in my browser the script is working, and a new json.txt is generated.
Thank you for your help !