Nós usamos (em um script perl que é iniciado em /etc/rc.local com
su {username} -c '/usr/local/bin/schermen start'
O script tem as opções "start", "stop" e "restart".
):
screen -d -m -S {screen_name} {$program_to_start}
A página man tem um aviso om usando -d -m
:
-m causes screen to ignore the $STY environment variable.
With "screen -m" creation of a new session is enforced,
regardless whether screen is called from within another screen session
or not. This flag has a special meaning in connection with the '-d' option:
-d -m Start screen in "detached" mode.
This creates a new session but doesn't attach to it.
This is useful for system startup scripts.
Extra:
-S sessionname When creating a new session, this option can be used
to specify a meaningful name for the session.
This name identifies the session for "screen -list"
and "screen -r" actions. It substitutes the default [tty.host] suffix.