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

  • Home
  • SEARCH
  • 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 8991223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:40:43+00:00 2026-06-15T22:40:43+00:00

I need to compute N operation (same operation) each hour. For the moment I

  • 0

I need to compute N operation (same operation) each hour.

For the moment I have my operations but I can’t understand execute it N time per hour:

 #!/bin/bash
 N=10; 
 # my operation
 sleep 3600/${N}

Any suggestion?

  • 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-15T22:40:44+00:00Added an answer on June 15, 2026 at 10:40 pm

    Well, the way you have it written now, it will only perform “my operation” once, after which it will sleep for 6 minutes, and then exit. What you need is a loop construct around those two lines. bash supports several different loop constructs, but probably the simplest for this case would be:

    #!/bin/bash
    N=10
    ((delay=3600/N))
    while true
    do
      # do something
      sleep ${delay}
    done
    

    Of course, there’s no provision for terminating the loop in this case, so you’ll have to exit with ^C or kill or something. If you only wanted it to run a certain number of times, you could use a for loop instead, or you could have it check for the [non-]existence of a certain file each iteration and exit the loop when you create or remove that file. The most appropriate approach depends on the bigger picture of what you are really trying to do.

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

Sidebar

Related Questions

I need to compute the means of of the first elements in each list,
I need to compute ICMPv6 checksum. I have found correct manual in RFC 2460
I can't find any PHP script to compute Krippendorff's Alpha . I need this
I need compute some join operations on my data, on the result of these
I need to compute monthly payment (M) for an installment loan given the loan
To solve some problem I need to compute a variant of the pascal's triangle
I'm beginning a computer vision project and I need to compute the horizontal and
I'm new to LINQ. I need to compute new_id as follows: public class C_Movement
Is it possible to compute resulting css style on the element manually (without need
I have installed Matlab r2010a on my computer I need use the function xlsread

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.