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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:51:45+00:00 2026-05-30T11:51:45+00:00

I need a script in bash to run two applications with different frequency. I’m

  • 0

I need a script in bash to run two applications with different frequency. I’m not that experienced with bash and need some help

I have two programs, m1 and m2, to be run at different rates over time (stress test). m1 is for example run every 10 seconds and m2 every 30 seconds. But it should be possible to change the frequency

  • 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-30T11:51:46+00:00Added an answer on May 30, 2026 at 11:51 am

    To simplify a couple of other answers:

    $ while sleep 10; do echo 1; done &
    $ while sleep 30; do echo 2; done &
    

    Note that if your “m1” and “m2” commands take time to execute, you won’t be running them every 10/30 seconds. The sleep is the delay between the end of one run and the start of the next.

    So if you really want to schedule these so they run every 10 or 30 seconds, use cron. Cron runs once per minute, so you need to have multiple cron jobs, offset with sleep:

    * * * * * m1
    * * * * * sleep 10; m1
    * * * * * sleep 20; m1
    * * * * * sleep 30; m1
    * * * * * sleep 40; m1
    * * * * * sleep 50; m1
    * * * * * m2
    * * * * * sleep 30; m2
    

    Note that if m1 takes more than 10 seconds to run, you’ll overlap, which may cause your computer to vanish into a quantum singularity.

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

Sidebar

Related Questions

I need to run a bash script as root (passwordless sudo or su not
I need to run a Bash script that can echo a 300 lines of
i need help in bash script I have a lic.txt at domain.com which contains
I have a bash script. I need to look if text exists in the
I am working on a bash script where I need to conditionally execute some
I need to set a system environment variable from a Bash script that would
I got a variable in a bash script that I need to replace. The
Lets say i have a python script at homedir/codes/py/run.py I also have a bash
I need to run a bash script and a perl program in detached background
I have a bash script that looks like the following: #!/bin/bash FILES=public_html/*.php # */

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.