Server Startup Script
Posted: 29 Jul 2010 16:37
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:
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
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
Thank you very much in advance for any help!
Regards
annih