Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9149629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:30:11+00:00 2026-06-17T11:30:11+00:00

Possible Duplicate: How to prevent the cron job execution, if it is already running

  • 0

Possible Duplicate:
How to prevent the cron job execution, if it is already running

I have a cron job that may take 2 mins or may take 5 hours to complete.
I need to make sure that this job is always executed.

My question is:

Will it start after the previous one is done or will they both run at the same time and mess up the database if i set it to execute every minute ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:30:12+00:00Added an answer on June 17, 2026 at 11:30 am

    They’ll run at the same time. The standard practice around this is to create a file lock (commonly referred to as a flock), and if the lock isn’t available, don’t run.

    The advantages to this over Zdenek’s approach is that it doesn’t require a database, and when the process ends, the flock is automatically released. This includes cases where the the process is killed, server rebooted, etc.

    While you don’t mention what your cron job is written in, flock is standard in most languages. I’d suggest googling for locks and the language you’re using, as this will be the more robust solution, and not relying upon random timeouts. Here are some examples from SO:

    • Shell script
    • Python
    • PHP
    • Perl
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Python: single instance of program I need to prevent a cron job
Possible Duplicate: Prevent duplicate entries in arraylist I have an arraylist of a particular
Possible Duplicate: Prevent click event from affecting parent jquery I have a DOM structure
Possible Duplicate: Prevent execution of parent event handler I'm using a nice plug-in (
Possible Duplicate: How to prevent duplicate posts via a browser refresh? I have a
Possible Duplicate: How to prevent SQL injection in PHP? I have a following MySQL
Possible Duplicate: Prevent execution of parent event handler I need to attach functions to
Possible Duplicate: How to prevent XSS with HTML/PHP? I know that in a lot
Possible Duplicate: Prevent Back button from showing POST confirmation alert I have used the
Possible Duplicate: Synchronizing a timer to prevent overlap I have a Threading.Timer in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.