in reply to A script that does an action every 5 minutes

In all likelihood, the best tool for this sort of job is a system utility like cron (installed on all *nix systems) or Windows' "Task Scheduler".