| Line 1... |
Line 1... |
| 1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
| 2 |
# $Id: alcasar-activity_report.sh 2267 2017-06-04 09:28:36Z richard $
|
2 |
# $Id: alcasar-activity_report.sh 2286 2017-06-20 08:32:30Z tom.houdayer $
|
| 3 |
#
|
3 |
#
|
| 4 |
# Create an activity report for ALCASAR every week (sunday at 5.35 pm --> see cron.d).
|
4 |
# Create an activity report for ALCASAR every week (sunday at 5.35 pm --> see cron.d).
|
| 5 |
# We read configuration files and logs to create cool charts.
|
5 |
# We read configuration files and logs to create cool charts.
|
| 6 |
# Written by Raphaël PION, Rexy & Tom HOUDAYER
|
6 |
# Written by Raphaël PION, Rexy & Tom HOUDAYER
|
| 7 |
|
7 |
|
| Line 571... |
Line 571... |
| 571 |
|
571 |
|
| 572 |
accces_date_intl=$(echo "${access_datas[0]} ${access_datas[1]}" | sed -E 's@^([0-9]{2})+/+([0-9]{2})+/+([0-9]{4})+@\3-\2-\1@') # Convert date format DD/MM/YYYY to YYYY-MM-DD
|
572 |
accces_date_intl=$(echo "${access_datas[0]} ${access_datas[1]}" | sed -E 's@^([0-9]{2})+/+([0-9]{2})+/+([0-9]{4})+@\3-\2-\1@') # Convert date format DD/MM/YYYY to YYYY-MM-DD
|
| 573 |
access_date=$(date -d "$accces_date_intl" +%s)
|
573 |
access_date=$(date -d "$accces_date_intl" +%s)
|
| 574 |
access_user=${access_datas[2]}
|
574 |
access_user=${access_datas[2]}
|
| 575 |
access_ip=${access_datas[3]}
|
575 |
access_ip=${access_datas[3]}
|
| 576 |
access_agent=${access_datas[4]}
|
576 |
access_agent=$(echo "$access" | cut -d'|' -f4)
|
| 577 |
if [ $access_date -lt $SECS_AGO ]; then
|
577 |
if [ $access_date -lt $SECS_AGO ]; then
|
| 578 |
break
|
578 |
break
|
| 579 |
fi
|
579 |
fi
|
| 580 |
|
580 |
|
| 581 |
access_date_formatted=$(date -d @$access_date +"%x %X")
|
581 |
access_date_formatted=$(date -d @$access_date +"%x %X")
|