MediaTemple limits their GridServer (GS) customers to only 5 cron jobs.
This makes absolutely no sense.
MediaTemple allows cron jobs to run as often as every 5 minutes … I needed more than 5 weekly processes, which put no strain on the server compared to someone who sets up 5 jobs to repeat every 5 minutes.
Limits on cron jobs by run frequency would be far too logical.
As a workaround, combine all your weekly crons into one daily job, your daily crons into an hourly job, etc. Then create a shell script that uses date logic tests to branch out to different jobs, based on the day of the week or hour of the day.
For example, here’s a daily cron script that branches out into weekly jobs:
if [ $(date +%u) -eq 1 ]; then ./monday.pl elif [ $(date +%u) -eq 2 ]; then ./tuesday.pl elif [ $(date +%u) -eq 3 ]; then ./wednesday.pl .... elif [ $(date +%u) -eq 7 ]; then ./sunday.pl fi
If you don’t have a job for every day of the week, just leave out the logic test for that day & the cron script will exit without running anything further.
Similarly with a cron script set to run hourly, you can test the hour to run up to 24 different daily jobs (one for each hour):
if [ $(date +%k) -eq 0 ]; then ./twelve-oclock-am.pl elif [ $(date +%k) -eq 1 ]; then ./one-oclock-am.pl elif [ $(date +%k) -eq 2 ]; then ./two-oclock-am.pl .... elif [ $(date +%k) -eq 23 ]; then ./eleven-oclock-pm.pl fi
Taking this to the extreme, in theory you could use an every-5-minutes cron job to test $(date +%M)
and run up to 12 different jobs per hour. And it goes without saying you can combine these day/hour/minute logic tests to create 2,016 possible combinations, or throw in some $(date +%d)
day-of-the-month tests for 62,496 possible cron jobs. Take that, MediaTemple-cron-limitation-type people!
Obviously the script names in the examples above (monday.pl, twelve-oclock-am.pl, etc) can be changed to anything you want.
I’m not on MediaTemple’s GridServer platform anymore, but hope this helps someone. I switched to a their DV/VPS platform & promptly discovered they assigned a blacklisted IP to my account. So far they are refusing to fix it. Good thing MediaTemple doesn’t sell cars.
UPDATE: To their credit, MediaTemple finally saw the logic in providing new accounts with non-blacklisted IPs, so that’s good.
Leave a Reply