crontab -e
# insert his:

# to timesync every 1 minutes
* * * * * /srv/www/scripts/poll_every_3_seconds.sh

vim /srv/www/scripts/poll_every_3_seconds.sh
# insert this:

for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
        /srv/www/scripts/poll_every_3_seconds.php ;
        sleep 3 ;
        echo $i >> /srv/www/scripts/poll_every_3_seconds.log;
done

# if you need it every second, do it like this:

for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
do
        /srv/www/scripts/poll_every_3_seconds.php ;
        sleep 1 ;
        echo $i >> /srv/www/scripts/poll_every_3_seconds.log;
done

# the .php file looks like this: (modify path to your php-cgi binary)

vim /srv/www/scripts/poll_every_3_seconds.php
# insert:

#!/usr/bin/php-cgi
<?php
echo "Hello World!";
?>

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin