You can use a cronjob library that takes care of locking jobs to prevent multiple executions - Preventing multiple executions
As an alternative you can use celerybeat
instead of cron
to control your jobs. Celerybeat
comes with more overhead but if you already use celery as part of your application, this shouldn't be too hard. This lists some advantages to celerybeat
What are the advantages of celerybeat over cron?
You have to persist state somewhere to indicate that a job is already running. The pid
technique is fine but an alternative is to use a Semaphore by implementing it either at the cache level (Memcache/Redis) or directly in the database. This is especially useful when there might not be a consistent file system available to manage pid files. Eg. You are running your app on Heroku.
Also ideally, try to make your cron jobs idempotent if you can i.e, even if the job runs multiple times in parallel, there are no side-effects to that.