LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   run cstrike server from rc.local as 'root' (https://www.linuxquestions.org/questions/slackware-14/run-cstrike-server-from-rc-local-as-root-495439/)

sl4ckw4re 10-25-2006 09:50 AM

run cstrike server from rc.local as 'root'
 
Hello. I'm running a fresh installed Slackware 11.0 with a custom compiled 2.6.18 kernel as a Counter-Strike server. This here is the command for starting the server
Code:

cd /usr/hlds && screen -A -m -d -S hlds ./hlds_run -game cstrike +ip 89.136.239.245 +sv_lan 1 -nomaster +maxplayers 22 +map de_dust2
and then use screen -r hlds to connect to it using screen whenever I have the need. If I execute the above command after my system boots up and log in as 'root' everything works ok and I can attach to the screen. But if I add these lines to /etc/rc.d/rc.local the server starts indeed but when I try to run screen -r hlds it doesn't find the hlds screen to attach to. I think this is because from rc.local the command is not run correctly (meaning it is not run as root, or something like that). So my question is, how can I run that command from rc.local under root credentials like I would had started it from the command line while logged in as root account ? I hope I've made myself clear, if not I'll try again :). Thank you.

Alien Bob 10-25-2006 10:01 AM

I think you should use:
Code:

su - root -c "cd /usr/hlds && screen -A -m -d -S hlds ./hlds_run -game cstrike +ip 89.136.239.245 +sv_lan 1 -nomaster +maxplayers 22 +map de_dust2"
if you want to run this from rc.local.

Eric


All times are GMT -5. The time now is 10:07 AM.