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
To simplify a couple of other answers:
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:
Note that if
m1takes more than 10 seconds to run, you’ll overlap, which may cause your computer to vanish into a quantum singularity.