Server Startup Script

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
annih
Engineer
Engineer
Posts: 3
Joined: 29 Jul 2010 16:02

Server Startup Script

Post by annih »

Hi!

I unpacked the generic binaries on my Debian Etch vRoot server in /etc/openttd
/etc/openttd is the home directory of user openttd
I run a dedicated server by cd-ing to /etc/openttd as root and sudo -u openttd nohup ./openttd -D > ded.log &

Runs fine - I could join the server and play. But unconfigged default server is not what I need. The doc states the server config would be found in ~/.openttd/openttd.cfg. As I put the config file into /etc/openttd/.openttd nothing happened as expected. Still default server after restarting.

I tried using root home as home directory (because I sudo as root - who knows...), putting openttd.cfg into /root/.openttd. No success. Later I more or less accidentally put the config into the base directory containing the openttd executable. Wow. That worked for some reason. Now I could finally configure the server.

Great. But what happens if my server crashes, reboots or whatever? The dedicated ottd server will be started again but it will be a completely new game. Solution: loading the last autosave automatically. I read around the manual and stepped over startup scripts. They are documented to be automatically executed in given circumstances. So I cd-ed into /etc/openttd/scripts and copied on_dedicated.scr.example to on_dedicated.scr and changed it's contents to:

Code: Select all

echo "Setting dedicated network server settings..."
server_name = "TESTING 2"
cd autosave
load 1
After playing a few minutes, letting the server create a new autosave and restarting the server nothing happened. Why did I expect this? I tried the same with on_server_connect.scr but again nothing happens when I connect to the server. Scripts also don't execute when I put them into /root/.openttd/scripts or /etc/openttd/.openttd/scripts. Putting the script files in the same directory as the config file did not help either.There seems to be no option in config toggling scripts. Now I got no ideas left and that's why I request your help. What am I doing wrong?

Thank you very much in advance for any help!

Regards
annih
Last edited by annih on 29 Jul 2010 17:10, edited 1 time in total.
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: Server Startup Script

Post by Eddi »

put the openttd.cfg in the working directory or the binary directory, when your user doesn't have a ~
annih
Engineer
Engineer
Posts: 3
Joined: 29 Jul 2010 16:02

Re: Server Startup Script

Post by annih »

The config already works - only if put in the binary executable's directory. The only remaining problem is that my scripts don't execute. Thanks anyway.
annih
Engineer
Engineer
Posts: 3
Joined: 29 Jul 2010 16:02

Re: Server Startup Script

Post by annih »

Solved.

Turned out to be wrong access flags. Script files were not readable for user openttd. Sry for wasting ur time.
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 4 guests