-1

So, I wanted my pi to run a game server on boot, but since root cannot run games, I can't run the game server on boot.If somebody could tell me how to do this, it would make my life easier.

When I try to run the command darkplaces-server -basedir /place/to/gamefiles/ +"$(cat /place/to/precommands)", I get a not found error.

The game server I'm running is darkplaces-server, and does not require sound or graphical output. Keep in mind that I am also not using the X server.

closed as off-topic by Milliways, joan, goldilocks Jan 3 '16 at 13:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center." – Milliways, joan, goldilocks
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I find it hard to conceive that root "cannot" do a thing. (Not saying that root "should" not do certain things). Could you please describe how you start the server (e.g. init scripts or cron)? – Ghanima Jan 3 '16 at 0:29
  • @Ghanima I start the server in a script. The command I'm using in a seperate script is: darkplaces-server -basedir /place/to/gamefiles/ +"$(cat /place/to/precommands)" – SpecialBomb Jan 3 '16 at 0:34
  • Try using the full path to the server and any other URL's in your script and make sure all the directories exist, to make debugging easier have your script print the full command and cwd then copy it to the command line and try running it, – Steve Robillard Jan 3 '16 at 0:43
  • There are some programs that do detect that they are being run as root - and for your own safety decline to start or just moan at you about it. Usually there is a good reason not to do so and mechanisms are provided to gain any necessary privilege elevation when super-user powers ARE required. FWIIW darkplaces-server is a rewritten Quake server - obviously the RPi is acting as a server for other devices and not participating as a player... – SlySven Jan 3 '16 at 1:55
  • 1
    The question is not specific to the Raspberry Pi, has been answered in the comments, and is asking the site to encourage foolishness. – joan Jan 3 '16 at 10:37
2

add this line to /etc/crontab;

@reboot pi darkplaces-server -basedir /place/to/gamefiles/ +"$(cat /place/to/precommands)"

replace pi with the apropriate username to run the server as

  • This did not work. I added the line above as you said. This also does not answer the question I asked, so I am down voting. – SpecialBomb Jan 3 '16 at 4:01
  • Did you ask a question? – Jasen Jan 3 '16 at 4:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.