Sample Header Ad - 728x90

How can I execute a command in a shell script in a loop and in background mode?

1 vote
0 answers
524 views
In Restart mplayer stream process on loss of internet connection -> use while true an answer is given to restart an external command of a shell script - mplayer - after a connection loss. One commentator also mentions that this solution does avoid high cpu usage - in contrast to this answer: Restart mplayer stream process on loss of internet connection -> use -loop 0 I want to extend this script record.sh that calls mplayer as background job via '&' so that it is also inert against internet connection losses or router reconnects. **As I am a beginner in shell scripting, I have difficulties to get a solution that uses something like** while true do mplayer http://YOURSTREAMHERE:8000/playlist.m3u -cache 1024 sleep 2 done **in the context of that record.sh script (which calls mplayer as a background task via &).** **How would a modified record.sh script look like that is inert to connection losses and does not use much CPU?**
Asked by user146500 (11 rep)
May 7, 2022, 04:15 AM
Last activity: May 11, 2022, 03:51 PM