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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:43:40+00:00 2026-05-25T18:43:40+00:00

QUESTION Would it work fine if I use sleep(300); to do a whole day

  • 0

QUESTION

Would it work fine if I use sleep(300); to do a whole day (24 hours) in 5-minute gaps?

This means, would set_time_limit (86400); work?

Then I can set my host’s schedule to only be used once every 24 hours.


INFO

I found what I am doing now on this question and am now using it to do something every 5 minutes. It works well and is on time with even the seconds correct. (Talking about the gap between each sleep) – it sleeps 3 times and then gets called again from my host’s-schedular.

I have a scheduled task set up at my host for every 15 minutes, problem is this is not happening every (precise) 15 minutes, but more like 16 and a bit minutes – and after a few hours it is totally out of sync.

If it’s possible to use it to not quit within 24hrs, then I can adjust the sleep in the code to make it execute exactly every 5 mins.


UPDATE

17:17:50 22-09-2011 Check done!
17:34:09 22-09-2011 Check done!
17:47:47 22-09-2011 Check done!

I ran a script that appended to a file the date and “Check done!” – this was without a loop and sleep and that is what I got.

  • 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-25T18:43:40+00:00Added an answer on May 25, 2026 at 6:43 pm

    If you use set_time_limit(0);, the code will never time out and run forever unless it exits first. For instance I write programs in PHP in a while(1) { ... } loop. It ran for about two weeks straight (then I had to restart my computer for some unrelated reason).

    Cron is usually accurate though. If your host’s cron is so out of sync, you should contact them and ask about it – that’s not normal.

    EDIT: Also, you might want to consider running it forever and start it manually, then having a cron task that checks if it’s still running, and restart it if it isn’t.

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

Sidebar

Related Questions

This question would probably apply equally as well to other languages with C-like multi-line
Following on from this question what would be the best way to write a
I've never really been poised with this question: But would it be a terrible
my question is how would I use an HTML::Template tag inside a value of
This seems like a silly question but I would really like your comments and
This is a bit of an open question but I would really like to
I started to use Dashcode with a Safari Custom Project, my apps work fine,
I have the lovely functions from my previous question , which work fine if
This is not a theoretical or general question about when to use pass by
This is a question about the use of type classes in Haskell. I get

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.