I want to start a program with SSH using PHP, which works fine, but now I want to kill the screen with PHP, but the only thing I know is the name of the screen. How do I find out the screen ID (automatically)?
Ssh – Find out screen id
gnu-screenPHPsshUbuntu
Best Answer
You can use the environment variable
$STY
to determine whether you're in a screen session and also what the name of the session is that you're inside.Example
Initially we're sitting in a terminal window, not inside of a screen session.
Spin up a screen session:
Connect to it:
Inside screen session:
Killing a session
With the name of the session you can kill it using
screen
.You can also use the number there too.
Confirm that its been killed: