What I need to have happen: PHP needs to launch an server app which has root permissions running in the background. All of this should be silent.
-Sudo is needed to allow php to perform an op that requires root permissions.
-Screen is required to allow the app to run outside the scope of the webpage which started the process.
-Expect is needed so that screen has a pts in which to run
-Sh is needed because whatever starts running needs to be backgrounded, presumably with the & operator. It would also need to pipe any output to /dev/null/since I don't want my PHP page returning anything. This is probably negotiable somehow if somebody can think of a better way to do the call in PHP (fork...?)
As an example, the script I tried to use was:
#!/usr/bin/expect -f
spawn sh ( screen -t srcds /usr/local/srcds_l/startserv )& > /dev/null
exit 0
For reference I am trying to start a Counter-Strike Source server, and startserv is the name of the C code which handles launching the server and collecting its output. Can anybody correct my syntax for that snippet, or tell me why its the wrong thing to do?