I have a program that runs in the foreground so I run it via a 'screen'. Is there a good start/stop/restart template for 'screen'? I need it to pass the commands to the screen and create it if it doesn't exist.
I think you're slightly confused.
All screen does is allow you to detach it from the current terminal, and reattach at a later date.
You can however, start a process within screen, detached.
I'm not sure what you mean by "template for screen" but the
Unfortunately, -d -R -S can't be used with -d -m, so you can't say "start a screen named myscreen in detached mode unless there's already a screen named myscreen". Once it's started, you'll have to use the ctrl-a ctrl-d command to detach it if you don't want it running in the foreground.
Anything after the options will be executed as a command in a new screen only, so you can execute
Note that if you run a command in screen, when that command exits so will screen.