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 6365629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:19:01+00:00 2026-05-25T00:19:01+00:00

I need to run scripts at dynamic times (coinciding with a datetime in a

  • 0

I need to run scripts at dynamic times (coinciding with a datetime in a database). Any ideas how to accomplish this?

Example:

Database says tomorrow at noon in 1 in a datetime field, then i want to run the script tomorrow at noon.

  • 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-05-25T00:19:02+00:00Added an answer on May 25, 2026 at 12:19 am

    A very simple approach is to have a cron-job call a PHP script every 1 minute, and have it check the database for things that need done. If something needs done NOW(), then do it and remove from database.

    You need to consider things like locking, process stacking, multiple processes, etc… to make this robust. But if your need is simple, this is a simple way to make it work.

    Add this to crontab:

    * * * * *   /usr/bin/php /path/to/my/script.php
    

    And in /path/to/my/script.php

    <?php
    $ts = time();
    
    // Run for up to 50 seconds
    while($ts + 50 > time())
    {
       ... SELECT id, job_stuff FROM JobTable WHERE JobDate <= NOW() ...
    
       process job
    
       ... DELETE job_stuff FROM JobTable WHERE id = ...
    
       sleep(5);       
    } 
    

    Note, this is not robust. A robust script would grab a record while locked, update it to a “processing” status, process it, and update it to a “complete” status. This means that multiple processes could work at this same time (even if accidental) and not duplicate jobs. Also, this means that a single failure would not stop the train.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Installshield 2008 Developer Edition and need to run SQL scripts against
I'm deploying a web site and I need to run large TSQL scripts contained
I need an Eclipse Plugin run shell scripts under Linux. I have a beautiful
I have a few sql scripts that I need to run via SQL*Plus. These
I have two scripts that often need to be run with the same parameter:
I need to run two perl scripts from one in parallel. How can I
I need to run multiple scripts(5 scripts) via cmd, I want to make sure
I need to log in to a site to run some scripts. Mechanize with
I need to run a script and have access to the default stdin (terminal
Basically I need to run the script with paths related to the shell script

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.