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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:18:32+00:00 2026-06-09T22:18:32+00:00

I want to put a php daemon to sleep (with System_Daemon::iterate()) so it runs

  • 0

I want to put a php daemon to sleep (with System_Daemon::iterate())
so it runs max 20 times randomly spread over an hour. maybe a min distance would be smart so it doesn’t run 20 times in the first half hour and 0 times in the second half.

i’m kinda stuck here and don’t know how to start with this one, any help is very apreciated!

  • 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-09T22:18:34+00:00Added an answer on June 9, 2026 at 10:18 pm

    i came up with one possible solution, i didnt try it out yet, so it main contain syntax or logic errors. because it is running as a daemon there is a never ending loop around it.

    // 3600 seconds or one hour
    $timeframe=3600;
    // run max 20 times in $timeframe
    $runtimes=20;
    // minimum delay between two executions
    $mindelay=60;
    // maxium delay between two executions
    $maxdelay=240;
    
    if ($cnt % $runtimes != 0) {
        $delay = rand($mindelay,$maxdelay);    
        System_Daemon::iterate($delay);    
        $sum += $delay;
        $cnt++;
    } else {
        //final delay till the $timeframe
        if ($sum < $timeframe) {
            System_Daemon::iterate($timeframe - $sum); 
        }  
        $sum=0;
    }
    

    its not perfect and u waste some time but i guess its going to fullfill the job.
    any comments?

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

Sidebar

Related Questions

I want something to put in my .htaccess file that will hide the .php
I want to encode binary file into base64 and put it into php page
I want to put in the PHP session an information if the client uses
I want to put my html navigation in a separate php file so when
I have the following php script now i want to put his script in
i have a php page it have css script. i want to put menubar
My backend is PHP I have a service that I want to put out
I want to have a user select a file and then have php put
How can I put a php statement between quotes, inside php? I want to
i am using dojo toolkit with php codeigniter 2.1.0 and i want to put

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.