I've come across the following scenario in one of the servers I recently have to manage. Its an Ubuntu used as a music streaming server, the music must be changed according to an schedule but the last sysadmin did it manually with 3 scripts (00-stop.sh, 10-server.sh and 20-client.sh) Here are the steps he used/explained to me:
- Run 00-stop.sh script to stop the streaming server.
- Change the list in the 20-client.sh script.
- Run 10-server.sh using "&" to keep it running in the background.
- Run 20-client.sh with the updated list,music will start streaming.
I think I could use Cron automation to change the music automaticaly, but I'm not sure how to do it. My idea is to have four scripts: 00-stop.sh 10-server.sh 20-client.sh (with music list 1) 30-client.sh (with music list 2)
And run either 20-client or 30-client accordint to schedule. Each cron job should call 00-stop.sh first, then 10-server.sh (and keep it in the background) and then either 20-client.sh or 30-client.sh.
I imagine something like:
0 10 * * 1 /path/00-stop.sh && /path/10-server.sh && /path/20-client.sh
The problem is that I need the second script (10-server.sh) to keep running in the background, how could I do it?