Using the linux screen command with php

z-hoster

Member
Aug 8, 2005
15
0
151
Hey guys!
I have a world of warcraft private server hosted on my server and i use the linux screen command to stop/start/restart the server. I would like to make a php module on my website that would allow me to do it from there with out having to use SSH. This way, my game staff will also have access to restart if needed.

So what i did so fare is:
$screen = exec('screen -r');

In SSH, that would output this:
There are several suitable screens on:
26714.worldserver_434(Attached)
26977.auth(Detached)
21829.pts-2.serveur(Detached)
But but instead of geting the above, the exec command returns "Must be connected to a terminal."

I saw a few work arrounds to this problem but i am unsure how to applie them to a cpenel envirement. Any help on this would be appreciated ;-)
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello :)

Is there any reason you prefer to use screen when running a command that should complete on it's own right away? It's typically used in cases where the user's connection might time out before a command finishes. Also, is the account assigned normal shell access or jailed shell access?

Thank you.