Author Topic: Tremulous log script Client side  (Read 3069 times)

slux_ITA

  • Posts: 38
  • Turrets: +0/-0
    • http://www.capponcino.it/alessio
Tremulous log script Client side
« on: March 19, 2007, 12:03:20 am »
Just a little bash script:
Code: [Select]
#!/bin/bash
#
# Tremulous log script
# By Slux-ITA - www.tremulous.it
#
# v1.2.1
#
# License: GNU/GPL v2
#
# Changelog:
#
# 1.2.1:
# [fix] clear tags log system complete! (thanks peoro)
#
# 1.2:
# [add] clear tags log system (only numeric tags)
#
# 1.1:
# [fix] tremulous args bug (thanks zukka)
#
# 1.0:
# first release
#
##########################################
########### - User configs - #############
##########################################

user_log_dir=~/.tremulous/logs/        # Log dir
trem_exec=/opt/tremulous/tremulous.x86 # Tremulous exec file
date_format=`date +%Y\_%m\_%d`         # Log file name (Prefix)
time_format=`date +%H\:%M\:%S`         # Log file time tags
clear_log_file="1"                     # if "1" a second clone file is created, without color tags like ^0 ^1 ^2 ... ^9 ..^f ^. ^w etc...

##########################################



if [ ! -d $user_log_dir ]; then
   mkdir -p "$user_log_dir"
fi

echo "" >> $user_log_dir$date_format".log"
echo "######################################" >> $user_log_dir$date_format".log"
echo "# START TIME: $time_format" >> $user_log_dir$date_format".log"
echo "######################################" >> $user_log_dir$date_format".log"
echo "" >> $user_log_dir$date_format".log"

#START!
$trem_exec $@ >> "$user_log_dir$date_format.log" 2>&1

#Clear current log
if [ $clear_log_file == "1" ]; then
sed -e 's/\^[^\^]//g' $user_log_dir$date_format".log" >  $user_log_dir$date_format"_no_tags.log"
fi

#all done
echo ""
echo "##### Good GAME `whoami`!!! #####"
echo ""



Stripped tag log example:
this chunk
Code: [Select]
^5P^7ie^5r ^2D^7_^1R^7 was pounced upon by ^7=^5V^7=^2ka^7ppo^9lo^7's Dragoon
]^cciao ^bbelli! ^qquesto e' ^ssolo un te^dst! :]
[S] ^3]^1iR^3[slux]^2I^7T^1A^3[^7: ^2^cciao ^bbelli! ^qquesto e' ^ssolo un te^dst! :]
[H] (^3]iR[^2Sen^7te^1nza^7): ^5mentre giocahiamo a questa
^3]iR[^2Sen^7te^1nza^7 was chomped by ^7=^5V^7=^2ka^7ppo^9lo^7's Dragoon
[A] ^1il^7gu^1fo^7@^1ar^7ch^2I^7T^1A^7: ^2?
[FC]Thakros[ITA]^7 was chomped by ^7=^5V^7=^2ka^7ppo^9lo^7's Dragoon
[H] ^5P^7ie^5r ^2D^7_^1R^7: ^2ciau slux

became cloned in a second file...
Code: [Select]
Pier D_R was pounced upon by =V=kappolo's Dragoon
]ciao belli! questo e' solo un test! :]
[S] ]iR[slux]ITA[: ciao belli! questo e' solo un test! :]
[H] (]iR[Sentenza): mentre giocahiamo a questa
]iR[Sentenza was chomped by =V=kappolo's Dragoon
[A] ilgufo@archITA: ?
[FC]Thakros[ITA] was chomped by =V=kappolo's Dragoon
[H] Pier D_R: ciau slux


The log dir is organized...one log file per day!
Code: [Select]
slux@skynet[~]
~> ll ~/.tremulous/logs/
totale 8552
167775643 -rw-r--r-- 1 slux users  615914 10 mar 22:50 2007_03_10.log
168085672 -rw-r--r-- 1 slux users  549084 10 mar 22:50 2007_03_10_no_tags.log
167772830 -rw-r--r-- 1 slux users  463183 12 mar 00:00 2007_03_11.log
167772831 -rw-r--r-- 1 slux users  413607 12 mar 00:00 2007_03_11_no_tags.log
...
167783787 -rw-r--r-- 1 slux users  689294 17 mar 00:26 2007_03_16.log
167783792 -rw-r--r-- 1 slux users  620436 17 mar 00:26 2007_03_16_no_tags.log
168400514 -rw-r--r-- 1 slux users  832029 18 mar 00:05 2007_03_17.log
168569329 -rw-r--r-- 1 slux users  768199 18 mar 00:05 2007_03_17_no_tags.log
167775630 -rw-r--r-- 1 slux users  498014 18 mar 23:44 2007_03_18.log
167779814 -rw-r--r-- 1 slux users  416508 18 mar 23:44 2007_03_18_no_tags.log



Byez!  :D

next_ghost

  • Posts: 892
  • Turrets: +3/-6
Tremulous log script Client side
« Reply #1 on: March 19, 2007, 12:50:29 am »
Why don't you use logrotate(8) like normal admins?
If my answer to your problem doesn't seem helpful, it means I won't help you until you show some effort to fix your problem yourself!
1.2.0 release's been delayed for 5:48:00 already because of stupid questions.

slux_ITA

  • Posts: 38
  • Turrets: +0/-0
    • http://www.capponcino.it/alessio
Tremulous log script Client side
« Reply #2 on: March 19, 2007, 10:01:53 am »
it's a good idea!  :)

Reading the manpage... :roll:

Angelwinged Devil

  • Posts: 65
  • Turrets: +0/-0
Tremulous log script Client side
« Reply #3 on: March 19, 2007, 10:47:35 am »
Quote from: "next_ghost"
Why don't you use logrotate(8) like normal admins?

hmm?
y hobby is to pwn
personal slaves: Taiyo, xinef

Paradox

  • Posts: 2612
  • Turrets: +253/-250
    • Paradox Designs
Tremulous log script Client side
« Reply #4 on: March 19, 2007, 11:09:55 pm »
Because logrotate doesnt run on all systems.

∧OMG ENTROPY∧

daenyth

  • Posts: 230
  • Turrets: +21/-26
Tremulous log script Client side
« Reply #5 on: March 19, 2007, 11:28:41 pm »
But why would you run a non-linux server?
Quote from: Bullislander05
It's like trying to take apple seeds out of a zebra to plant a giraffe tree.