1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
imapsync/memo
Nick Bebout 1b3773e80f 1.456
2011-09-25 15:31:48 -05:00

268 lines
7.4 KiB
Bash
Raw Blame History

#!/bin/sh
# $Id: memo,v 1.35 2011/08/22 00:31:14 gilles Exp gilles $
software_version() {
VERSION=`cat VERSION`
}
statistics_lfo() {
# 62.147.165.21 - - [31/Oct/2010:23:45:28 +0100] "GET /prj/imapsync/VERSION HTTP/1.0" 200 6 "-" "imapsync/1.368 (linux system, perl 5.8.8, Mail::IMAPClient 2.2.9 imapsync)"
#grep prj/imapsync/VERSION /usr/local/apache/logs/access_log | sort -n | cut -d ' ' -f 1,12,13|uniq -c | sort -n # list ip
cat <<EOFF
ssh glamiral@linux-france.org "grep -h prj/imapsync/VERSION /usr/local/apache/logs/access_log.bak|cut -d ' ' -f 1,12,13,18,19|sort -n|uniq -c|sort -n" # list ip
ssh glamiral@linux-france.org "grep -h prj/imapsync/VERSION /usr/local/apache/logs/access_log.bak|cut -d ' ' -f 1,12,13,18,19|sort -n|uniq -c|sort -n|wc" # count ip
ssh glamiral@linux-france.org "grep -h prj/imapsync/VERSION /usr/local/apache/logs/access_log.bak|cut -d ' ' -f 1,12,13,18,19|sort -n|uniq -c|sort -n |grep MSWin32" # Win32
ssh glamiral@linux-france.org "grep -h prj/imapsync/VERSION /usr/local/apache/logs/access_log.bak|cut -d ' ' -f 13,18,19 |sort -n|uniq -c| sort -n" # OS usage+basename
ssh glamiral@linux-france.org "grep -h prj/imapsync/VERSION /usr/local/apache/logs/access_log.bak|cut -d ' ' -f 12 |sort -n|uniq -c| sort -n" # imapsync release
tail -f /usr/local/apache/logs/access_log|cat -n|grep prj/imapsync/VERSION|cat -n |grep VERSION # lfo frequency
EOFF
}
statistics_ks() {
cat <<EOFF
ssh root@ks "cd /var/log/apache2/;grep -h prj/imapsync/VERSION access.log access.log_????????|cut -d ' ' -f 1,12,13,18,19|sort -n|uniq -c|sort -n" # list ip
ssh root@ks "cd /var/log/apache2/;grep -h prj/imapsync/VERSION access.log access.log_????????|cut -d ' ' -f 1,12,13,18,19|sort -n|uniq -c|sort -n|wc" # count ip
ssh root@ks "cd /var/log/apache2/;grep -h prj/imapsync/VERSION access.log access.log_????????|cut -d ' ' -f 1,12,13,18,19|sort -n|uniq -c|sort -n |grep MSWin32" # Win32
ssh root@ks "cd /var/log/apache2/;grep -h prj/imapsync/VERSION access.log access.log_????????|cut -d ' ' -f 13,18,19 |sort -n|uniq -c| sort -n" # OS usage+basename
ssh root@ks "cd /var/log/apache2/;grep -h prj/imapsync/VERSION access.log access.log_????????|cut -d ' ' -f 12 |sort -n|uniq -c| sort -n" # imapsync release
tail -f /var/log/apache2/access.log |cat -n|grep prj/imapsync/VERSION|cat -n |grep VERSION # ks frequency
EOFF
}
statistics_VERSION_lfo() {
TMPDIR=.
export TMPDIR
echo statistics_VERSION_getstats
statistics_VERSION_getstats() {
for f in /home/lf/backuplog/linux-france.org.??-??-2011.bz2; do
b=`basename "$f" .bz2`
#echo "$b"
test -f ${b}.imapsync_VERSION && continue
echo NOT DONE ${b}.imapsync_VERSION
bzip2 -dc "$f" | grep -h /prj/imapsync/VERSION > ${b}.imapsync_VERSION
done
}
echo statistics_VERSION_monthly_ip 08
statistics_VERSION_monthly_ip() {
month=${1:-`date '+%m'`}
cut -d ' ' -f 1,12,13,18,19 linux-france.org.??-${month}-2011.imapsync_VERSION |sort -n |uniq -c|sort -n > stats_imapsync_2011_${month}.ip
}
echo statistics_VERSION_monthly_ip_wc 08
statistics_VERSION_monthly_ip_wc() {
month=${1:-`date '+%m'`}
test -f stats_imapsync_2011_${month}.ip || statistics_VERSION_monthly_ip $month
wc -l stats_imapsync_2011_${month}.ip
}
echo statistics_VERSION_monthly_runs 08
statistics_VERSION_monthly_runs() {
month=${1:-`date '+%m'`}
test -f stats_imapsync_2011_${month}.runs || wc -l linux-france.org.??-${month}-2011.imapsync_VERSION > stats_imapsync_2011_${month}.runs
cat stats_imapsync_2011_${month}.runs
}
echo statistics_VERSION_monthly 08
statistics_VERSION_monthly() {
month=${1:-`date '+%m'`}
(
statistics_VERSION_getstats
statistics_VERSION_monthly_ip $month
statistics_VERSION_monthly_runs $month
statistics_VERSION_monthly_ip_wc $month
)
}
echo statistics_VERSION_synthesis
statistics_VERSION_synthesis() {
(
cd /home/lf/glamiral/imapsync_stats
echo Nb users each month
wc -l *.ip
echo Nb runs each month
tail -n 1 *.runs
)
}
}
statistics_VERSION_ks() {
TMPDIR=.
export TMPDIR
echo statistics_VERSION_getstats
statistics_VERSION_getstats() {
(
cd /home/imapsync/imapsync_stats
for f in /var/log/apache2/access.log_????????.gz ; do
b=`basename "$f" .gz`
#echo "$b"
test -f ${b}.imapsync_VERSION && continue
echo NOT DONE ${b}.imapsync_VERSION
zgrep -h /prj/imapsync/VERSION "$f" > ${b}.imapsync_VERSION
done
)
}
echo statistics_VERSION_monthly_ip 08
statistics_VERSION_monthly_ip() {
month=${1:-`date '+%m'`}
(
cd /home/imapsync/imapsync_stats
cut -d ' ' -f 1,12,13,18,19 access.log_2011${month}??.imapsync_VERSION |sort -n |uniq -c|sort -n > stats_imapsync_2011_${month}.ip
)
}
echo statistics_VERSION_yearly_ip
statistics_VERSION_yearly_ip() {
(
cd /home/imapsync/imapsync_stats
cut -d ' ' -f 1,12,13,18,19 access.log_2011????.imapsync_VERSION |sort -n |uniq -c|sort -n > stats_imapsync_2011.ip
)
}
echo statistics_VERSION_monthly_ip_wc
statistics_VERSION_monthly_ip_wc() {
month=${1:-`date '+%m'`}
(
cd /home/imapsync/imapsync_stats
test -f stats_imapsync_2011_${month}.ip || statistics_VERSION_monthly_ip $month
wc -l stats_imapsync_2011_${month}.ip
)
}
echo statistics_VERSION_monthly_runs
statistics_VERSION_monthly_runs() {
month=${1:-`date '+%m'`}
(
cd /home/imapsync/imapsync_stats
# test -f stats_imapsync_2011_${month}.runs ||
wc -l access.log_2011${month}??.imapsync_VERSION > stats_imapsync_2011_${month}.runs
cat stats_imapsync_2011_${month}.runs
)
}
echo statistics_VERSION_monthly 08
statistics_VERSION_monthly() {
month=${1:-`date '+%m'`}
(
statistics_VERSION_getstats
statistics_VERSION_monthly_ip $month
statistics_VERSION_monthly_runs $month
statistics_VERSION_monthly_ip_wc $month
)
}
echo statistics_VERSION_synthesis
statistics_VERSION_synthesis() {
(
cd /home/imapsync/imapsync_stats
echo Nb users each month
wc -l *.ip
echo Nb runs each month
tail -n 1 *.runs
)
}
}
niouzes_compil() {
(
cd /g/public_html/www.linux-france.org/html/
m4 niouzes.m4 > niouzes.xml
python ./niouzes/getmynews.py --neuf niouzes.xml > niouzes-neuf.html
python ./niouzes/getmynews.py --html niouzes.xml > niouzes-html.html
)
}
lfo_announce() {
software_version
NEWS_FILE="/g/public_html/www.linux-france.org/html/niouzes/niouzes_imapsync.xml"
if ! newer VERSION $NEWS_FILE; then
echo "$VERSION already announced"
else
cat > $NEWS_FILE << EOF
<news date="`date '+%Y%m%d'`">
`LANG=fr_FR date '+%A %d %B %Y'` : Synchronisez ou migrez vos boites
aux lettres avec <20>conomie et l'outil <A
HREF="prj/imapsync/">imapsync $VERSION</A> (Gilles LAMIRAL)
</news>
EOF
fi
niouzes_compil
}
#' nedit sucks with syntax color
fm_init() {
software_version
NEWS_FILE_FM="./freshmeat_submition"
NEWS_FILE_FM_INP=${NEWS_FILE_FM}.inp
NEWS_FILE_FM_OUT=${NEWS_FILE_FM}.json
}
fm_read_param() {
# read definitions
. $NEWS_FILE_FM_INP
}
fm_read_announce() {
fm_init
fm_read_param
cat << EOF
{
"release": {
"tag_list": "stable, $RELEASE_FOCUS",
"version": "$VERSION",
"hidden_from_frontpage": false,
"changelog": "$TEXT_BODY"
}
}
EOF
}
fm_announce() {
fm_init
if ! newer VERSION $NEWS_FILE_FM_OUT; then
echo "$VERSION already submitted on freshmeat"
else
if newer VERSION $NEWS_FILE_FM_INP; then
echo "Update $NEWS_FILE_FM_INP please"
return 1
fi
fm_read_announce > $NEWS_FILE_FM_OUT
curl -X PUT -d @../../var/pass/secret.freshmeat -d @$NEWS_FILE_FM_OUT \
-H "Content-Type: application/json" \
http://freshmeat.net/projects/imapsync.json
fi
}