Personal tools

Lynxx's ShrubLogger

From Bunkerwiki

Jump to: navigation, search
Lynxx's ShrubLogger
shrubl

Subscriber-inessential.png Developer(s) : Lynxx
Notes-icone-9348-32.png Version : 1.17
Glob-v2-48x48.png Website : rawhi.de
Home-home-page-onebit-icone-5226-32.png Forum discussion : bunkergaming


Dload.gif


ShrubLogger

  • You get this additional features via crontab:

ShrubUpdate.sh - keep track of the players levels over time

kill_IF_EMPTY.sh - restarts the server once every night, to keep logfiles small


  • You get this additional commands in the shell:
>levels partofname or partofguid
Prints the levelhistory for this player(s)
Outputs full guid and every match found with exact date.
>alllevels
Print the levelhistory for all connected players (needs a working finger-commands, etadmin-finger wont work)
>findplayer name
Find a player on a bunker-server
>checkserver (name)
Prints info about the server, servername, started, map running, spectators, players
All connected players, with xp, ping, team


  • You get his additional commands in the game via etadmin_mod:
>!levels partofname or partofguid
Prints the levelhistory for this player(s)
Outputs only the partly guid you also see in !listplayers, maximum displays 5 matches, "fancy dates" - like yesterday, 5w (5 weeks)
>!findplayer name
Find a player on a bunker-server
>!checkserver (name)
Prints info about the server, servername, started, map running, spectators, players

ShrubLogger


Normally all admins decide by feeling when someone should get a new level, but this could result in someone leveling 2 or more levels in a very short time. Because noone knows when did player X get his last levelupgrade ?

Here is the solution, ShrubLogger - it should run at least every 24h, will scan the shrubbot.cfg and remember when players got their levels in shrubhist.cfg.

You just have to start it once manually to see if the install of java and so on are ok, then you set up a cron-job (crontab -e) with:

code

#Execute ShrubUpdate every 6h
#M S T M W Befehl
0 0,6,12,18 * * * ./ShrubUpdate


  • When you setup this alias (or similar):

alias levels='cd /usr/local/games/enemy-territory/noquarter;java ShrubLogger'


  • You can then simply search for players with:

levels partofname or partofGUID


For example: levels lyn

ShrubLogger .... by Lynxx - for |>B<|unker-Community
Searching for 'lyn' ...
|>B<|Lynxx|A| / F9F282346C685288D8835B2BED8E80E0 LVL: 1=1.1.2003,2=20.3.2003,3=16.6.2003,4=31.10.2003,...,666=31.12.2005,1000=1.6.2006


Ofcourse there is no real history right now, because all players got their levels 'brand new', but that's why i've written the tool, in the future you will see something like:

Imnew / 855BF9F2288D8836C62BED823480E08E LVL: 1=5.1.7,2=20.3.7,3=1.6.7,4=22.9.7

From today it's running on B2.


You need to install any Java (JDK1.02 ++) on your server, installing under current user is enough, no need for root.

Edit

  • If there are duplicate GUID's in the shrubbot.cfg (like MadCow was twice in B2's config)

you will get an error-output - if an error occurs during it's excuted as cron-job you will revive an email with the error.

In case you may worry it will slow down the server, runtime for including reading shrubbot.cfg / shrubhist.cfg and writing shrubhist.cfg (1304 Admin-Entries) - is 4 seconds on B2.

2nd Edit

  • Update to V1.03

et-colorcodes will be removed for from hist-file and search, this way it's easier to find someone. When you do a manual search, it will update the histfile before in case something changed.

3rd Edit

  • Update to V1.04

now with etadmin-mod addon, put 'levels.sh' in etadminmod/addons and add the command to some level, on B2 i let lvl 8 and higher use the command. The command itself recognizes etadmin-mod using the '-e' switch. While in etadmin-mode it doesnt update the history for fast feedback/low resourceuse.

The output will be limited to 5 lines, no header and no GUIDS.

4th Edit

P3y wants color-codes for etadm .. so another update to V1.05, changed year to full YYYY.

5th Edit

  • Entries which are removed from shrubbot.cfg will also be removed from history, now it's also a needful help to find 'duplicates' - for example B!O has 4 entries in shrubbot in the moment ...

Some more updates .. now it will also say how much entries found when more than 5, say when no entry found, output a part of the GUID (12chars). So if your unsure or cant find an entry , !finger the person - and !levels PARTOFGUID .. works also.

V1.09 Released

Mow instead of raw dates for example '1.1.2007' it will output 'fancy dates' - for example '4 days ago' - special request from p3y.

V1.10 Released

Minor Update - some small optimiziations, added !shrubhist for lvl 421++ which will update the history, only needed after some !setlevel and you want to check again ... The cron-job will do the same every 24h.

V1.11 Released

Now the output of the GUID is exactly the same as !listplayers, for example: (*D6825216)

V1.12 Released

Made a little mistake in 'fancy' Dates-calculation, added now for example 3.2y .. Added 'nice -n 19' (lowest pri) to the calls, this way et-server want be influenced by the tool.

V1.13 Released

  • ShrubLogger V1.13 - on 8.5.2007 by Lynxx - for |>B<|unker-Community

Usage: ShrubLogger (-f / -e) partofname or GUID partofname is for example 'lyn' or you could define a GUID (partly) to use.

-f show levels of ppl on the server (needs working finger-command)
-e etadmin-mode, will only print the last part of a GUID like !listplayers

Without parameters 'shrubbot.cfg' will be read and level-history written to 'shrubhist.cfg'.

  • Added the -f parameter which first reads the server-port, and rcon-password from server.cfg, then connect to localhost:server-port and get the online players via 'getstatus'.

Then 'rcon RCONPW finger partofplayername' (because no spaces allowed) is launched, first i wanted to use the slot-numbers, but that will fail wenn for example two players with a zero in their name are connected.

  • Those rcon-calls must delayed by around 750ms, that's why it will take a while to print all players info, but it's still a lot faster than doing everything by hand.
  • Output will look like:
CODE
[etadm@bunker2 noquarter]$ alllevels
Levelhistory for all players on |>B<|Bunker #2 XP.30map:
|>B<|*Sniperken*|A| / |>B<|*Sniperken* 13=7.5.2007
Deminwarrior / Deminwarrior 7=30.4.2007
>BlacqWidow< / Widow 6=20.4.2007
BlacqFR33DOM / BlacqFR33DOM 2=1.5.2007
|>B<| broken / |>B<| broken 11=7.5.2007
|>B<|KarLOTto[ChillaZ] / |>B<|KarlOTto[ChillaZ] 9=1.1.2007
Rolph - NEW PLAYER
StonedRaiders.Twee / Twee 3=25.4.2007
Pezzo - NEW PLAYER
HOLYMoly / holy moly 1=4.5.2007
winnField - NEW PLAYER
CommanderCool / WeWantYourSoul 1=16.4.2007
SattaBuzz / SattaMaDProf 4=1.1.2007
don-diego / don-diego 1=1.1.2007
eXo. / eXo. 1=5.5.2007
(T)BlacqPyro / !Pyromaania! 3=23.4.2007
FreeFighter-=NL=- - NEW PLAYER
  • First the current playername, second the name in shrubbot.cfg and finally when he got his level and which one.

V1.14 Released

Oops, reformatted the sourcecode and added some comments i found a bug in the first line of main(), i forgot to check if it's started with any arguments at all. sad.gif Which created an ArrayIndexOfOufBounds-Exception when it should Update the history (started without args).

V1.15 Released

Formatted the all players output, makes it easier to read:

CODE

Playername on the server      | Playername in shrubbot        |level | date
------------------------------+-------------------------------+------+------------
>YATAHEY<<                    | YATAHEY                       |    3 | 25. 4.2007
|>B<|onyx                     | dark->onyx                    |   11 | 30. 4.2007
sdjfhga                       | Israel xXx                    |    2 | 10. 2.2007
foraby                        | foraby                        |    4 |  8. 4.2007
EgoR                          | ***NEW PLAYER***              |    - | -
BlacqgBjork                   | bjork*                        |    3 | 23. 2.2007
LYSY                          | ***NEW PLAYER***              |    - | -
Twee                          | Twee                          |    4 |  9. 5.2007


^^ d0h whats that - no fixed width font in the code-tag !? :-/

Well at least in the console you will get a nice table showing the levels.

The Source-Code is included in the file, so you can take a look - no network-access outside localhost, no backdoors or anything illegal.

V1.16 Released

Alllevels now also lists xp of the players:

code

Levelhistory for all players on |>B<|Bunker #2 XP.30map:

Playername on the server | Playername in shrubbot   |     xp |level| date
-------------------------+--------------------------+--------+-----+------------
Marine                   | ***NEW PLAYER***         |   1925 |    -| -

V1.17 Released

Merged with CheckServer-Project, abstract class PlayerEntry for xp-sorting - both projects inherit from this and use the static functions in ShrubUtils. Removed entries from shrubhist.cfg will be written to ShrubLogger.log

Alllevels-Output will now sorted by XP. Only 1 jar-file now - merging the projects and storing in one compressed file reduces total code-size to around 30%.

CheckServer

I wrote a simple program which checks how many players are currently on the server,

Output will look like:

code

[etadm@bunker2 ~]$ checkserver
Server: |>B<|Bunker #2 XP.30map
Map: etsbay
15 Players:
BlacqKaW
Marine
-=ZaRNaK=-
...

code

[etadm@bunker1 enemy-territory]$ checkserver
Server: |>B<|Bunker #1 [XP Save]
Map: facility31_b1
58 Players:
|>B<|ScrewLoose
Barto
|>B<|Abys@lDemon<-
...


Ofcourse all playernames will be printed.

I mainly wrote this program to return the number of players as returncode, because i set up a cronjob for b1 & b2 which will be executed at 5 am (ofcourse local time, when server is usually empty).

Which does: '/usr/local/games/enemy-territory/kill_IF_EMPTY.sh'

And this script uses CheckServer to check if the server is really empty and kill ET if that's true. This way we shouldn't have any more problems with huuuuge logfiles, normally every day there will be a new logfile.

Edit: Added Source, Class and Scripts as attachment

V1.01 released

Oops .. little update, B2 returns not P=-------- when no players connected. And fixed a little bug, when a portnumber is given (-p xyz) and that port cant be opened, it also returned "0".

V1.02 released

Output changed, startdate/time added.

code

Server: |>B<|Bunker #2 XP.30map 
started: 08/17/2007 05:00:31 
map: sw_oasis_b3 players: 0
Socket-Timeout of 1000ms added.

V1.03 released

  • grrrr .. again ppl staying in spec to save xp on b1 ...

Output changed, spectators dont count as players. Tonight it will be:

code

Server: |>B<|Bunker #1 [XP Save] 
started: 08/16/2007 05:00:30 
map: password2 specs: 3 players: 0
Disco Stu
shotdead
|>B<| MUPPET


And server will restart anyway, so the 'staying over night to save xp' is history.

V1.04 released

Beautified the output/added slotnr, xp, ping, team

code

Server: |>B<|Bunker #1 [XP Save] 
started: 08/16/2007 05:00:30 
map: flame-guards 
specs: 3 
players: 0
Slot|   XP   |Ping | T | Name
----+--------+-----+---+------------------------------
 25 |      0 |  98 | S | Disco Stu
 30 |      0 |  50 | S | shotdead
 32 |      0 | 123 | S | |>B<| MUPPET


Still no FIXED width font in code-tag ...

V1.05 released

-s - Server-Parameter added now you you can do locally, or on B1/B2:

checkserver -s bunker1.aaxxss.com

or for example:

checkserver -s 85.25.148.155 -p 27961

(That's "|AaA| Brotherhood #2,7map")

Better exception-handling (UnknownHostException, SocketException), more detailed output.

V1.06 released

-t - Timeout-Parameter added - this way you can define a large timeout than 1000ms, in case slow connection
-q - Quiet-Parameter - Default is now to print full information, i did this to enable asking for parameters via "checkserver -?" and using it locally  without  giving "-f" all the time.

V1.07 released

.. d0h .. those 3 peeps where still on at 5 am and a european player connected .. :-/

Added

-c - Datecheck-Parameter, if this parameter is given it will NEVER return 0 when server-startdate = current date.

This allows a change to the crontab:

code

0 3,4,5,6,7,8 * * * /usr/local/games/enemy-territory/kill_IF_EMPTY.sh

This means it will check at 3,4,5,6,7 and 8 am if the server is empty and kill if it is - but server will only be killed ONCE a day.

V1.08 released

Improved error-handling - should be foolproof now. Removed some unneccessary code. Fixed the kill_IF_EMPTY.sh, forgot -c flag. Documented the code.

V1.09 released

-h - Header only mode
-f - Find mode - List consists of servername - playername in each row, no header

This allows adding 2 scripts to etadmin_mod and a command for the players:

!findplayer partofname

Returns up to 3 matches, servers search are B1,B2,B3,B4,B5,B6,B7,B8 & B10

Results are cached, if there was no query for 10 seconds the 'db' will be rebuild asynchron with lowest priority.

Added shell-command for B1/B2 'findplayer'

V1.10 released

If only an argument given without "-" infront it will be used as servername. Removed a bug which could cause an endless loop. Better scripts for shell/etadmin_mod - if a player is found it will abort immediatly instead of searching all servers first. Auto-Kill script works fine, output removed (which created emails). -h - Header mode, only shows the serverinfo and specs/players connected

Added a etadmin_mod-command 'checkserver' which always runs in header-mode, avail for every LVL8++, usage: !checkserver !checkserver bunker1.aaxxss.com !checkserver bunker5.aaxxss.com -p 27560

V1.11 released

-e - Etadmin-Mode - colorcodes wont be stripped and extra-colorcodes for the output New findplayer.sh for etadmin, which also allows searching with colorcodes.

V1.12 released

Support for portformat which et uses, which means you can write bunker5.aaxxss.com:27560 (bunker 8) -k configfile.cfg - enables Kickmode - this needs the configfile which contains the rconpassword -m n - maximum count (default 3) - maximum times a player is allowed in spectator mode, then CheckServer will try to kick the player (used in kill_IF_EMPTY.sh - which is executed at night to restart the server) Currently CheckServer will be started in the (local) time from 1-8am every 30 mins with maximum-speccount of 7 - which means spectators will be kicked after 3 hours. Actions are written to CheckServer.log in the mod-folder.

V1.13 released

Default is now sorting by XP, not slot-number Shortcuts for bunker-servers, you can use "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8" and "b10". -x - Dont sort by XP Merged with ShrubLogger-Project, abstract class PlayerEntry for xp-sorting - both projects inherit from this and use the static functions in ShrubUtils. Only 1 jar-file now - merging the projects and storing in one compressed file reduces total code-size to around 30%.


Back-32x32.png