Per the docs we can only have 100 scheduled apex jobs at any one time in most orgs (5 in dev orgs). Which jobs count towards those limits?
Would the following query return the right number?
SELECT COUNT() FROM CronTrigger WHERE CronJobDetail.JobType = '7' AND State IN ('WAITING', 'ACQUIRED', 'EXECUTING', 'PAUSED', 'BLOCKED', 'PAUSED_BLOCKED')
Is there dynamic way to retrieve the overall limit so that you don't have to know if you're in a dev org or note and you don't need to update your code as limits increase?
You can only have 100 scheduled Apex jobs at one time. You can evaluate your current count by viewing the Scheduled Jobs page in Salesforce and creating a custom view with a type filter equal to “Scheduled Apex”. You can also programmatically query the CronTrigger and CronJobDetail objects to get the count of Apex scheduled jobs.
from Apex Scheduler Docs
Maximum number of Apex classes scheduled concurrently 100. In Developer Edition orgs the limit is 5.