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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:47:57+00:00 2026-06-18T17:47:57+00:00

I basically have a cron job which runs every night that updates thousands of

  • 0

I basically have a cron job which runs every night that updates thousands of products in my database.

The reason I run the cron job at night is because there will be less latency on the servers as not many people visit the site during this time, the cron job can pretty much run on for days without any interference.

Here is what the cron job command looks like

30 23 * * *     /usr/bin/php /var/www/ul/prices_all.php >> /var/www/ul/log/prices_all.txt

What I would like to know is would it be possible to create a cron job which kills this process after 5 hours e.g.

30 05 * * *     kill /var/www/ul/prices_all.php[process]
  • 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-18T17:47:58+00:00Added an answer on June 18, 2026 at 5:47 pm

    You can do this with timeout (coreutils):

    30 23 * * *   timeout 18000  /usr/bin/php /var/www/ul/prices_all.php >> /var/www/ul/log/prices_all.txt
    

    It simply sets a timeout (18000secs = 5 hours) and kills the process if it is still running after that time.

    Or you can set a timeout in the php file itself:

    <?php set_time_limit(18000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this bash script on the server that runs every hour, via cron.
I have a MySQL query that runs via cron every 30 minutes to delete
I have a php file that runs as a cron job. That file gets
I have cron jobs setup that runs a few PHP scripts often. The issue
I have a table in my MySQL DB which basically contains cron-like tasks. Basically
We have a business application that basically runs on an os-independent stack (tomcat+java+mysql) but
we have set up a cron job that cleans off old orders for our
I basically have a program that filters records from one excel file to another
I basically have 7 select statements that I need to have the results output
We have a database that gets updated everyday at midnight with a cronjob, we

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.