#!/bin/sh # Présences aux réunions if [ "$1" = "autoconf" ]; then echo yes exit 0 fi if [ "$1" = "config" ]; then echo 'graph_title Koumbit - presences aux reunions' echo 'graph_vlabel personnes' echo 'graph_category wiki' # echo 'totalpresences.label total' echo 'reflexion.label reflexion' echo 'production.label production' echo 'sysadmin.label sysadmin' echo 'vieasso.label vie-asso' # echo 'embauche.label embauche' echo 'ca.label ca' echo 'graph_args --base 1000 -l 0' exit 0 fi NOW_YEAR=`date +"%Y"` NOW_MONTH=`date +"%m"` NOW_DAY=`date +"%d"` show_for_meeting () { COMITE=$1 EXPRESSION=$2 # get 3 latest, since there may be future meetings, we will filter out later echo -n "$COMITE.value " FILES=`ls -1d /export/wiki/wikis/koumbitwiki/data/pages/$EXPRESSION* | sort -r | grep -v Template` for file in $FILES do FILE_YEAR=`echo $file | sed "s/.*(2f)\([0-9][0-9][0-9][0-9]\)(2d).*/\1/"` FILE_MONTH=`echo $file | sed "s/.*(2d)\([0-9][0-9]\)(2d).*/\1/"` FILE_DAY=`echo $file | sed "s/.*(2d)\([0-9][0-9]\)$/\1/"` # Make sure the document has a past date, not future DATE_PAST="no" if [ $FILE_YEAR -lt $NOW_YEAR ]; then DATE_PAST="yes" fi if [ $FILE_YEAR -le $NOW_YEAR ] && [ $FILE_MONTH -lt $NOW_MONTH ]; then DATE_PAST="yes" fi if [ $FILE_YEAR -le $NOW_YEAR ] && [ $FILE_MONTH -lt $NOW_MONTH ] && [ $FILE_DAY -lt $NOW_DAY ]; then DATE_PAST="yes" fi if [ "$DATE_PAST" = "yes" ]; then REVISION=`cat "$file/current"` LATEST_FILE="$file/revisions/$REVISION" # http://www.ilfilosofo.com/blog/2008/04/26/sed-multi-line-search-and-replace/ sed -n -e '1,/sences confir/d' -e "1h; 1!H; $ { g; s/\([^-']*\).*/\1/g; p; } " $LATEST_FILE | grep -c '\*' return fi done echo 0 } show_for_meeting reflexion MeetingsDeR show_for_meeting sysadmin "Comit*SysAdmin" show_for_meeting production "MeetingsDeProduction(2f)20" show_for_meeting vieasso "Comit(c3a9)VieAssociative(2f)20" # show_for_meeting embauche "Comit(c3a9)Embauche(2f)20" show_for_meeting drupal "Comit(c3a9)Strat(c3a9)gieDrupal(2f)20" show_for_meeting ca "MeetingsCa(2f)20"