I would like to have a (bash) script executed once or twice every second in the background. I see two possible solutions:
- Include a loop in the script (with a sleep command) and execute the script once.
- Include no loop and have the script executed repeatedly via a systemd timer.
So my questions are:
- What are possible drawbacks and advantages to these approaches?
- Are there better alternatives?