If you are using cPanel on your host, you can go to Advanced --> cron jobs.
Then inside there you can set a cron job command like this:
wget http://yoursite.com/yourfile.php
which http://yoursite.com/yourfile.php
should point to your desired function.
You can also set repetition time interval over there.
This way yourfile.php
is called in specified intervals.