Native Linux server (with management scripts)

"you could just remove the password."

You can understand why not many would assume that right, because that does not make any logical sense, remove password means remote connections are blocked, who would have thought :D I've left the password on and just done the iptables as I have tried remote telnet directly.

So I've been succesfully running PHP scripts in your evented .sh scripts with the #!/usr/bin/php shebang with the assistance of https://github.com/ngharo/Random-PHP-Classes/blob/master/Telnet.class.php .
<basedir>/hooks/playerConnect/ping.sh

Code:
#!/usr/bin/php
<?php
require_once('class-telnet.php');
....
$telnet = new Telnet('127.0.0.1','8081',10,'');
$ping = getPing($argv[6]);
$country = geoip_country_name_by_name($argv[6]);
$telnet->exec('Welcome, '.$argv[4].'. Your ping is '.$ping.'ms ('.$country.')';
?>
And your done, the same goes for all other hooks like responding to chat /commands and cron for timed server messages.

(remember cron doesn't unfortunately support incrementals so running something every 43 minutes actually only runs once an hour at 43 minutes past the hour, instead of 0:43, 1:26, 2:09, 2:52, etc... I'm not quite sure why but it sounds so retarded that there has to be a really, really, really absolute reason for it. Marvels of *nix I guess.)
I been waiting for something like this, gonna try it out :D

does the server need to be restarted for new hooks to be used, and if the file is changed on the fly its updated without restart?

also basedir as in /home/sdtd/hooks/playerConnect/ping.sh ? or can the basedir be from the instance? /home/sdtd/instances/<Name>/

 
"you could just remove the password."
You can understand why not many would assume that right, because that does not make any logical sense, remove password means remote connections are blocked, who would have thought :D
Well, if you use the instance editor it tells you about this ;)

does the server need to be restarted for new hooks to be used, and if the file is changed on the fly its updated without restart?
No need to restart, hooks are read when an event is occuring.

also basedir as in /home/sdtd/hooks/playerConnect/ping.sh ? or can the basedir be from the instance? /home/sdtd/instances/<Name>/
The former one. You get the instance name passed as parameter so if you want to have different actions you can check based on this param.

 
so I got the php script working with class-telnet.php.... ie it sends to the server as .php file from the webserver..

but can't seem to get the .sh version of it working (/home/sdtd/hooks/playerConnect/ping.sh)

class-telnet.php is in the same folder aswel...

there any error logs? where would i find them

"No need to restart, hooks are read when an event is occuring."

I haven't restart the server instance either... but its like the ping.sh file isn't being read at all someone joins the server.

like i don't see any php errors for it in apache log folder where I would if I was running the script as .php

even tried adding

#!/usr/bin/php<?php

ini_set("log_errors", 1);

error_reporting(E_ALL);

ini_set('error_log','/home/sdtd/hooks/playerConnect/errors.log');
 
jeeez it was because the .sh file was created on windows fffff

had to dos2unix the files ...now it works :D

 
Is there a way to get current online players from an instance?

Like with the below info?

Player ID

Entity ID

Nickname

Steam ID

Client IP

 
There seems to be a interesting bug? with logs and filenames when the day changes.

It's now 2014-08-30 00:40 and it still shows me

Code:
current_chat.log -> /home/sdtd/instances/one/logs/2014-08-29_11-26-40_chat.log
meaning chat logs are going nowhere readable and there is no file 2014-08-30...

 
There seems to be a interesting bug? with logs and filenames when the day changes.
It's now 2014-08-30 00:40 and it still shows me

Code:
current_chat.log -> /home/sdtd/instances/one/logs/2014-08-29_11-26-40_chat.log
meaning chat logs are going nowhere readable and there is no file 2014-08-30...
Well, the time in the logfile-name is the time you started the instance. So this won't change unless you restart the instance. The content should be just fine anyway.

 
Where is the files for the webserver and how do I access the webpage where I can see the map? I can't find any information about ports, url etc.

 
Where is the files for the webserver and how do I access the webpage where I can see the map? I can't find any information about ports, url etc.
Wasn't yet meant to be a fully official feature of the mod so I didn't document it yet on the wiki ;)

You can get the files on SVN one by one here: SVN

Or download the folder as a tar.gz archive here: Download archive

Just make sure that you end up with ...\<7dtd-folder>\webserver\index.html etc.

Also you have to have the control panel enabled. You should then be able to access the map on http://<yourIpOrDomain>:<port of control panel + 2>/

yeh but how to get the information that a telnet lpe command returns?
You have to send the command to the Telnet port and wait for its output and then parse that output.

 
None, when connecting to Telnet you communicate over that connection in both directions. You send commands and on the same connection you will receive the result.

 
yup got it working now, well thats cool.. shame the query protocol is still broke as hell.. doesn't display playernames or id's but does display how long those unknown players have been online on the server.

btw alloc is there anyone who has come up with a way of converting the explored randomgen maps into image tile format so it can be used on a website to show where all players are on the map?

 
yup got it working now, well thats cool.. shame the query protocol is still broke as hell.. doesn't display playernames or id's but does display how long those unknown players have been online on the server.
Could be for security reasons. Not sure if Valve would like it if a game just publicly announced the steamids as you could watch who's playing.

btw alloc is there anyone who has come up with a way of converting the explored randomgen maps into image tile format so it can be used on a website to show where all players are on the map?
Not sure what you're talking about exactly. There's the tool to render the map offline written by cumu: http://7daystodie.com/forums/showthread.php?14947-Export-discovered-map-to-png

And the server fixes also render the map live while people visit the world.

 
Thanks. I copied the files to the 7-Days folder and restarted the instance. But there is nothing listening on port control + 2. And neither status or settings show anything about a webserver port. But I guess that it should'nt be there or is not implemented yet?

Great work on the server, man!

Wasn't yet meant to be a fully official feature of the mod so I didn't document it yet on the wiki ;) You can get the files on SVN one by one here: SVN

Or download the folder as a tar.gz archive here: Download archive

Just make sure that you end up with ...\<7dtd-folder>\webserver\index.html etc.

Also you have to have the control panel enabled. You should then be able to access the map on http://<yourIpOrDomain>:<port of control panel + 2>/

You have to send the command to the Telnet port and wait for its output and then parse that output.
 
"There's the tool to render the map offline written by cumu: http://7daystodie.com/forums/showthr...red-map-to-png

And the server fixes also render the map live while people visit the world. "

yeh thats a nice tool I started using that.. the server fixes rendering the map live.. thats in the <instance>/Random Gen/<server>/map/

folder? but is there anything to display all the tiles like the other mapping tool?

also I started getting this after starting an instance...

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

Done!

not sure why

 
Thanks. I copied the files to the 7-Days folder and restarted the instance. But there is nothing listening on port control + 2. And neither status or settings show anything about a webserver port.
Do you have control panel enabled? Do what does the log contain?

yeh thats a nice tool I started using that.. the server fixes rendering the map live.. thats in the <instance>/Random Gen/<server>/map/folder? but is there anything to display all the tiles like the other mapping tool?
Yup, that's what jimmyh and I are currently talking about too ;) (And a lot of refs before)

I'll write a short documentation later on, don't want to repeat this over and over again ;)

also I started getting this after starting an instance...shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

Done!
Hm, where do you get it? Console? Does the stuff work besides the error? I.e. server running, logs get filled, especially the logs/current_*.log?

 
tbh i didn't check the logs.. cus everything is working fine.. its just odd I get it now. I get it in terminal console after doing 7dtd.sh start <instance>

 
I tried compiling the source for the server fixes, but ran into the following errors: "Use of unassigned out parameter". It seems like the Vector2i structs are being used before getting a value assigned.

You dont happen to have hint as to why this is occuring? I must admit that I have never done anything with mono before..

Edit:

Oh and I second this:

And maybe Alloc could modify /usr/local/lib/7dtd/commands/stop.sh with maxwait=15 for servers that run a bit larger maps/userbases and giving additional mercy for badly behaving 7dtd processes.
I think it could be quite handy, because my instance seems to be taking too long to shutdown correctly :D .

 
Last edited by a moderator:
Back
Top