I'm having a bit of trouble with GNU's screen. What I want to do is this (from
If a screen session named cron exists, add a new window to the session and launch a process in it (but do not attach to the session). Otherwise, create a new session called cron and launch the process in it (again, do not attach). If possible, all of this should be done using just one "screen" command.
I've already tried a bit but haven't come to a solution that satisfies all of my needs:
screen -S cron -dRRm screen ping example.com screen -S cron -X screen ping example.com
Is there something I have missed?