OpenArena Message Boards

OpenArena => Multiplayer => Topic started by: MilanFIN on September 27, 2011, 11:59:17 AM



Title: Adding automatic console printing stuff to server?
Post by: MilanFIN on September 27, 2011, 11:59:17 AM
Hi

I have been very happy with my server, it is quite stable etc.
But now I'd like to ask if it is possible to add automatic notifications that are printed for example every 5 minute.
I saw that on italian oa-server where console printed that you can still play on 081 servers with oa 085.
How can that be made, what settings to server config?


Title: Re: Adding automatic console printing stuff to server?
Post by: Gig on September 27, 2011, 12:11:41 PM
I think they are achieved using some third party tools, like Big Brother Bot
(DO NOT LINK) h t t p s : / / openarena . wikia . com/wiki/Servers#Server_managers


Title: Re: Adding automatic console printing stuff to server?
Post by: Cacatoes on September 27, 2011, 02:31:15 PM
crcon and a bit of shell may also help you there.
Get linux version here: http://download.tuxfamily.org/openarena/other/crcon/
You can use some "cron task" in order to achieve that 5 minutes thing.
Depends of the kind of server you use.

Not related to what you want, but here is a script using it I wrote for fun.
It pops up a dialog window so you can send the command you want on every server listed inside the script.

Code: (file bash oa-rcon.sh)
#!/bin/bash
CRCONPATH="/opt/crcon" # changez le chemin de crcon
RCONPASSWORD="" # mettez votre mot de passe RCON entre les guillemets

server1="91.121.201.15"
port1="27961"
server2=""
port2=""
server3=""
port3=""

function envoyer
{
  $CRCONPATH -p $RCONPASSWORD -P $2 $1 "$3"
}

function envoyer_aux_serveurs
{
  envoyer $server1 $port1 "$1"
  envoyer $server2 $port2 "$1"
  envoyer $server3 $port3 "$1"
}

message="`zenity --entry --width 400 --title "RCON vers Serveurs" --text "Message:"`"

[ $? -eq 0 ] && envoyer_aux_serveurs "$message"


Title: Re: Adding automatic console printing stuff to server?
Post by: MilanFIN on September 28, 2011, 05:03:15 AM
I have just a normal oa 0.8.5 server.


Title: Re: Adding automatic console printing stuff to server?
Post by: Cacatoes on September 28, 2011, 05:25:08 AM
... running which operating system ?


Title: Re: Adding automatic console printing stuff to server?
Post by: MilanFIN on September 28, 2011, 06:22:42 AM
Ubuntu 10.04


Title: Re: Adding automatic console printing stuff to server?
Post by: RMF on October 02, 2011, 02:37:52 PM
Am I the only one always naming functions and variables in English when programming, even when the code is not meant to be reused by others?
Code is generally not language specific, but functions and variables always undermine this. When internationally collaborating, it's of course nessesary to write everything in English, but I actually always do. I simply think in English when coding, because all built-in functions are english.

This just caught my eye when reading your code. But maybe that's just me, I often think in English. Like now when writing this message, but also on random other moments or even when preparing dutch conversations xD


@MilanFIN, I'm not familiar with Ubuntu or Linux enough to help you step by step with this. I'll give a rough explaination of what I think you have to do now.

It seems cronjobs aren't natively installed (I thought so actually) so you probably have to download it from the site Cacatoes mentioned. After that you have to modify the script so the servers, ports and rconpassword are set properly (and maybe your install path for cron), and save it as 'something.sh' where 'something' can be anything you like. I think the message goes in the second-to-last line of the script, but I'm not sure about that. Then you should probably execute (doubleclick probably) the .sh file.
This is as much as I can help I think. Could use an ubuntu live usbstick tomorrow to test myself, but I think it's easier if cacatoes can just help you ;)


Title: Re: Adding automatic console printing stuff to server?
Post by: Cacatoes on October 04, 2011, 04:48:38 AM
It's a badly designed script which I used for fun, the only purpose of the script was to send gibberish to ROFL players when I am inspired, otherwise I use XQF for rcon administration.
It was also for me a way to experiment a "use case" I usually don't when writing scripts, I mean: using a dialog window for input (''zenity'').
Most of the time I write code in a mix of french/english without even questionning myself, I could tend to write exclusively in english for more serious programs, but then it depends too of who for it is.
Writing code in 2 languages has the advantage you can more easily separate formal instructions from real-world entities, attempts to give a meaning outside of the procedural.
But I don't write enough code so it's not like I could elaborate much on this :p

@Milan,
You have several solutions,
- Best would be to use crontab. If you can't use it directly, maybe the hosting service you're on has a particular option to planify cron tasks (like in some admin panel)
- Other would be to use a script which has a timed mechanism, I never do that but I suppose it's possible, like:
Code:
while true
do
  sleep 5m
  /opt/crcon #... + arguments, message, etc.
done
- Or use some other OA tool which already does that, but I don't know which one.




Title: Re: Adding automatic console printing stuff to server?
Post by: MilanFIN on October 07, 2011, 06:17:16 AM
Could I just make a script to the config, that the console says something and waits 5min and says again.
Like yours Caca but in config?


Title: Re: Adding automatic console printing stuff to server?
Post by: 7 on October 07, 2011, 07:15:07 AM
There is no need whatsoever to install crcon on the same host as the OA server is running. You could install crcon.exe on any Windows box that's online 24/7 and use the Windows scheduler instead of a Unix cronjob to run the crcon message.


Title: Re: Adding automatic console printing stuff to server?
Post by: MilanFIN on October 08, 2011, 01:20:02 AM
But I am not using windows, using ubuntu

Is there just some file like sprees.dat in oa that I could include the text.
If I would add it to sprees.dat, it would print it every time someone makes 5, 10, 15... kills without dying :D
Is it possible to make it to another file.


Title: Re: Adding automatic console printing stuff to server?
Post by: 7 on October 08, 2011, 02:19:16 AM
What you want can't be done in the OA configuration. If you're running Ubuntu at home you should:

1) Test if cron is installed by entering crontab -l in a console (it says something like "command not found" if cron is not installed)
2) If cron isn't installed you should install it by entering sudo apt-get install cron in a console
3) Download and install crcon as Cacatoes instructed above
4) Make your crontab by entering crontab -e in a console and put something like this in it:

Code:
*/5 * * * * /opt/crcon -p 'ServerPassword' -P ServerPort ServerIP 'Your text to display every 5 minutes.' > /dev/null

That's it.