| Revision 7614 (by gradha, 2006/12/02 18:13:42) |
Whitespace cleanup. |
#!/bin/sh
# $Id: author_statistics_update.sh 7614 2006-12-02 18:13:42Z gradha $
# This script is meant to be once a month, to report how long
# ago each webmaster touched his work. You can run this on your
# SourceForge account, as long as you have the right permissions
# to access the allegro directory and related stuff.
# Modify this variable to include which users are to be excluded
# from the generated author log.
IGNORED_USERS=hstokset,tjaden,anoncvs_pisg,shji,ggodlewski,frederic_lopez,lillo
if [ -n "$1" ]; then
run_program="no"
start_dir=`pwd`
if test -e "$0.lock"; then
if (ps ux|grep -v grep|grep `cat "$0.lock"` > /dev/null 2>&1); then
echo Process $0 is still alive
ps ux|grep -v grep|grep `cat "$0.lock"`
else
run_program="yes"
fi
else
run_program="yes"
fi
if test $run_program == "yes"; then
echo $$ > "$0.lock"
# Put here the code to run inside the process lock, so that
# no two instances are run at the same time ever.
cd $1
OUTPUT=$HOME/cvs-author-statistics$PPID
python scripts/cvs-author-statistics.py -i $IGNORED_USERS -f $OUTPUT
until test -f $OUTPUT; do
sleep 1h # Be kind to SF when there is a temporary failure.
python scripts/cvs-author-statistics.py -i $IGNORED_USERS -f $OUTPUT
done
mv $OUTPUT out/cvs-author-statistics
echo "
Last update: `date -I`" >> out/cvs-author-statistics
chown .alleg out/cvs-author-statistics
chmod 664 out/cvs-author-statistics
TEMP=$HOME/temporal$PPID
echo "
Monthly webmasters activity report:
===================================
This is an automatic mail generated monthly. The purpose of this
mail is to remind translators of the last commited work they have
done. The current policy states that one year of inactivity is
considered an orphan translation:
http://alleg.sf.net/docs/webmaster_instructions.html#rules-for-translators
=====
" > $TEMP
cat out/cvs-author-statistics >> $TEMP
cat $TEMP | mail alleg-www-commits@lists.sourceforge.net -s "Monthly webmasters activity report"
rm $TEMP
######
# Here ends the code to run inside the process lock.
cd $start_dir
rm "$0.lock"
fi
else
echo "Not enough parameters.
Usage: script allegrowww_module_root_directory
Example (ideal for a crontab entry):
$SHELL $HOME/allegrowww/scripts/author_statistics_update.sh $HOME/allegrowww
The python interpreter must be in your PATH.
"
fi