A bunch of processes have failed – and you’d like to restart them in a screen session in case you need to rerun them in an interactive shells (for instance to answer prompts from the processes) – lots of Ctrl-A-C … start command …. Ctrl-A-S … name the window … and repeat later there has to be an easier way!
Step 1: Create a background screen session to hold the runs
This will open a new screen session named “ScreenSessionName” into the background (so you don’t need to Ctrl-A-d):
# screen -dmS ScreenSessionName
Step 2: Build a simple shell script to quickly add the commands with labels
For each command to run add a line like:
screen -S ScreenSessionName -X screen -t TaskTitle /path/to/example/command -args as -needed
And then execute that shell script – each process will run and if it needs user input will be waiting inside the screen. Processes that run and complete without any interaction required will finish and be removed from the screen session (so it’s easy to attach to the screen session and see exactly what is still running).