My (free) webhoster allows me to run ONE cronjob (through their web interface). But I need to run Two. One cronjob every 10 minutes, and another one every Hour.
They're both PHP-files. Is there a way to just have one job (that runs every 10 minutes) that executes the 10-minute-job and then also executes the hour-job every 6 runs?
You can have the cron run every 10 min, then have some code like the following in it:
if ((int)date('i') < 5) { // run other job } // run main job
I'm checking if less than 5 minute mark just in case it doesn't run at exactly mm:00. You can have less than that error if you want, say 2 or something.
This will run the 10 minutes job every time cron runs, and 1 hour job only when the minutes is less than 5.
You can even put the hour job in the background so it runs at same time as 10 min job. I'll leave this as an exercise.