var/bans.txt symbolic link ?

For all the help you need with Armagetron!
User avatar
Galaxip
Core Dumper
Posts: 112
Joined: Wed Aug 24, 2016 10:49 pm

var/bans.txt symbolic link ?

Post by Galaxip »

im currently running 12 servers and was wondering if its possible to use a symbolic link from all servers to a single bans.txt file so that if i ban someone in 1 server they will be banned in all servers ?

will it cause issues ? I dont want to break something !

thanks
Image Image Image
randomly changing stuff in your code until it works is "hacky" and "bad coding practice"
do it fast enough and its "machine learning"

User avatar
Z-Man
God & Project Admin
Posts: 11427
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Re: var/bans.txt symbolic link ?

Post by Z-Man »

Well, the servers don't use any kind of file locking when writing to files. So if they're shared, two servers may write to it simultaneously, which can't be good. Also, they definitely will only read information from that file on every restart, so bans will take a while to travel from one server to the other.
The other thing that might happen is that the servers will simply destroy the link and replace it with a plain file. Depends on the details of the write, which I don't have in my head right now. If you're not worried about losing data for the reason above, you just have to try.

User avatar
Galaxip
Core Dumper
Posts: 112
Joined: Wed Aug 24, 2016 10:49 pm

Re: var/bans.txt symbolic link ?

Post by Galaxip »

z-man thanks

i didnt consider the servers only read the file during startup so instant ban across all servers isnt going to work

i'll try something scripted that sends the ban command to all servers

thanks dude
Image Image Image
randomly changing stuff in your code until it works is "hacky" and "bad coding practice"
do it fast enough and its "machine learning"

User avatar
delinquent
Match Winner
Posts: 728
Joined: Sat Jul 07, 2012 3:07 am

Re: var/bans.txt symbolic link ?

Post by delinquent »

I think a better option might be to write a service that checks the collection of banfiles across all servers, and writes any differences to the other files based on the file that was most recently modified. That would cover players being both banned and unbanned.

User avatar
Galaxip
Core Dumper
Posts: 112
Joined: Wed Aug 24, 2016 10:49 pm

Re: var/bans.txt symbolic link ?

Post by Galaxip »

delinquent wrote:
Tue Aug 04, 2020 2:48 am
I think a better option might be to write a service that checks the collection of banfiles across all servers, and writes any differences to the other files based on the file that was most recently modified. That would cover players being both banned and unbanned.
thanks thats a good idea but still the other servers will not be update until they restart and reload their ban files

i think sending the ban and unban commands into all servers would give the instant ban/unban im looking for
Image Image Image
randomly changing stuff in your code until it works is "hacky" and "bad coding practice"
do it fast enough and its "machine learning"

User avatar
delinquent
Match Winner
Posts: 728
Joined: Sat Jul 07, 2012 3:07 am

Re: var/bans.txt symbolic link ?

Post by delinquent »

You could still use that service, then. Check for recent modifications, and then echo the command to each running server.

User avatar
Galaxip
Core Dumper
Posts: 112
Joined: Wed Aug 24, 2016 10:49 pm

Re: var/bans.txt symbolic link ?

Post by Galaxip »

delinquent wrote:
Tue Aug 04, 2020 6:26 pm
You could still use that service, then. Check for recent modifications, and then echo the command to each running server.
i'll look into this, thanks
Image Image Image
randomly changing stuff in your code until it works is "hacky" and "bad coding practice"
do it fast enough and its "machine learning"

User avatar
Galaxip
Core Dumper
Posts: 112
Joined: Wed Aug 24, 2016 10:49 pm

Re: var/bans.txt symbolic link ?

Post by Galaxip »

i had a go at parsing the file to check for updates but i wasnt getting far with the code so I went with scripting something

my servers have a script that already parses ladderlog data for various stuff like displaying the top players and such
so I used the INVALID_COMMAND trigger when you enter /somecommand that doesnt exist

added two commands for global ban and global unban
/gb ipaddress time message
/gu ipaddress

these send BAN_IP/UNBAN_IP commands with arguments to the 14 servers, tested and it works great
Last edited by Galaxip on Fri Aug 14, 2020 3:51 pm, edited 1 time in total.
Image Image Image
randomly changing stuff in your code until it works is "hacky" and "bad coding practice"
do it fast enough and its "machine learning"

User avatar
delinquent
Match Winner
Posts: 728
Joined: Sat Jul 07, 2012 3:07 am

Re: var/bans.txt symbolic link ?

Post by delinquent »

Could you upload it to the resource manager? I have a feeling other server admins will find this incredibly useful. Nice work

User avatar
Galaxip
Core Dumper
Posts: 112
Joined: Wed Aug 24, 2016 10:49 pm

Re: var/bans.txt symbolic link ?

Post by Galaxip »

thanks to nelg for pointing out that I could intercept the ADMIN_COMMAND on ladderlog so now i have a new improved version
ive removed the two new commands and just intercept the original /admin ban_ip and /admin unban_ip events in ladderlog which is much nicer
Could you upload it to the resource manager? I have a feeling other server admins will find this incredibly useful. Nice work
sure its written in bash XD i hope thats ok

erm wheres the resource manager XD
Image Image Image
randomly changing stuff in your code until it works is "hacky" and "bad coding practice"
do it fast enough and its "machine learning"

User avatar
delinquent
Match Winner
Posts: 728
Joined: Sat Jul 07, 2012 3:07 am

Re: var/bans.txt symbolic link ?

Post by delinquent »

http://resource.armagetronad.net/resource/

click

Code: Select all

upload to resource
at the top left and login with your forums link. The uploader will automatically create any file paths not already in existence from the path you specify, and the resource will be available at

Code: Select all

resource/galaxip/<path>

User avatar
Galaxip
Core Dumper
Posts: 112
Joined: Wed Aug 24, 2016 10:49 pm

Re: var/bans.txt symbolic link ?

Post by Galaxip »

i'll strip it down the the bare minimum needed because its currently full of other stuff like displaying top players at and of match and other things and submit it shortly

thanks
Image Image Image
randomly changing stuff in your code until it works is "hacky" and "bad coding practice"
do it fast enough and its "machine learning"

User avatar
aP|Nelg
Match Winner
Posts: 593
Joined: Wed Oct 22, 2014 10:22 pm
Contact:

Re: var/bans.txt symbolic link ?

Post by aP|Nelg »

You're uploading a script to the main map resource? Is that even possible?

User avatar
Galaxip
Core Dumper
Posts: 112
Joined: Wed Aug 24, 2016 10:49 pm

Re: var/bans.txt symbolic link ?

Post by Galaxip »

that resource link isnt https I dont really want to login there so i'll post it as a zip here
Attachments
mcp.zip
(854 Bytes) Downloaded 23 times
Image Image Image
randomly changing stuff in your code until it works is "hacky" and "bad coding practice"
do it fast enough and its "machine learning"

User avatar
Galaxip
Core Dumper
Posts: 112
Joined: Wed Aug 24, 2016 10:49 pm

Re: var/bans.txt symbolic link ?

Post by Galaxip »

aP|Nelg wrote:
Fri Aug 14, 2020 5:16 pm
You're uploading a script to the main map resource? Is that even possible?
probably not, i never got to try XD
Image Image Image
randomly changing stuff in your code until it works is "hacky" and "bad coding practice"
do it fast enough and its "machine learning"

Post Reply