Rev 16433 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
15818 | guerimand | 1 | # GetServerstat |
2 | # Fournit des statistiques sur le serveur |
||
3 | # version, adresse, etc... |
||
4 | # provides server informations |
||
5 | # option= |
||
6 | # class : number of class of each level |
||
7 | # user : number of user of each level |
||
8 | # classgeoloc : geoloc file of class |
||
9 | # servergeoloc : geoloc of the server |
||
16433 | guerimand | 10 | # server : connexion server statistique |
15818 | guerimand | 11 | # Usage : |
12 | # /wims.cgi?module=adm/raw&job=getserverstat&option= |
||
13 | |||
16433 | guerimand | 14 | !bound option within class,user,classgeoloc,servergeoloc,server default $empty |
15818 | guerimand | 15 | !if $option!=$empty |
16433 | guerimand | 16 | !if $option=server |
17 | test=!fileexists wimshome/log/account/00access.act |
||
18 | !if $test=yes |
||
19 | file=stat.server |
||
15818 | guerimand | 20 | !sh mkdir -p $wims_home/$wims_sesdir/getfile/stat;\ |
16433 | guerimand | 21 | start1=`date -d "1 week ago" '+%Y%m%d'`;\ |
22 | start2=`date -d "1 month ago" '+%Y%m%d'`;\ |
||
23 | start3=`date -d "1 year ago" '+%Y%m%d'`;\ |
||
24 | awk 'BEGIN {a1=0;b1=0;c1=0;a2=0;b2=0;c2=0;a3=0;b3=0;c3=0};\ |
||
25 | $$1>='$$start1'{a1=a1+$$2;b1=b1+$$3;c1=c1+$$4};\ |
||
26 | $$1>='$$start2'{a2=a2+$$2;b2=b2+$$3;c2=c2+$$4};\ |
||
27 | $$1>='$$start3'{a3=a3+$$2;b3=b3+$$3;c3=c3+$$4};\ |
||
28 | END {print "week "a1" "b1" "c1;print "month "a2" "b2" "c2;print "year "a3" "b3" "c3;};' $wims_home/log/account/00access.act > $wims_home/$wims_sesdir/getfile/stat/$file; |
||
16579 | guerimand | 29 | |
15818 | guerimand | 30 | !else |
16433 | guerimand | 31 | ident_type=wims |
16579 | guerimand | 32 | error=nostat |
16433 | guerimand | 33 | !endif |
34 | !else |
||
35 | ty=!positionof item $option in class,user,classgeoloc,servergeoloc |
||
36 | file=!item $ty of stat.class,stat.user,class.geoloc,server.geoloc |
||
37 | !let test=!fileexists wimshome/log/stat/$file |
||
38 | !if $test=yes |
||
39 | !if $ty>2 |
||
40 | !sh mkdir -p $wims_home/$wims_sesdir/getfile/stat;\ |
||
41 | ln -s -f $wims_home/log/stat/$file $wims_home/$wims_sesdir/getfile/stat/$file; |
||
42 | !else |
||
43 | !sh mkdir -p $wims_home/$wims_sesdir/getfile/stat; |
||
44 | a=!record -1 of wimshome/log/stat/$file |
||
45 | b=!word 2 to -1 of $a |
||
46 | a=!word 1 of $a |
||
47 | !writefile wimshome/$wims_sesdir/getfile/stat/$file $a\ |
||
15818 | guerimand | 48 | $b |
16433 | guerimand | 49 | !endif |
50 | !else |
||
51 | ident_type=wims |
||
52 | error=nofile |
||
15818 | guerimand | 53 | !endif |
54 | !endif |
||
55 | !else |
||
56 | ident_type=wims |
||
57 | error=badoption |
||
58 | !endif |
||
59 | fname = $wims_sesdir/getfile/stat/$file |