add gather stats cron job to people for ticket 4822
This commit is contained in:
parent
9cd22bd47e
commit
5b839475df
3 changed files with 55 additions and 0 deletions
5
roles/people/files/grab-daily-logs.cron
Normal file
5
roles/people/files/grab-daily-logs.cron
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# openstack/rdo
|
||||||
|
bash /usr/local/bin/grab-daily-logs.sh /repos/openstack/ rdo
|
||||||
|
# aarch64 image
|
||||||
|
bash /usr/local/bin/grab-daily-logs.sh F21-20140407-foundation-v8.tar.xz aarch64-stats
|
40
roles/people/files/grab-daily-logs.sh
Executable file
40
roles/people/files/grab-daily-logs.sh
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# skvidal - 2013-06-25
|
||||||
|
# takes 2 args: grep_search_string subdir_to_write_to
|
||||||
|
# ex: bash grab-daily-logs.sh /repos/openstack/ rdo
|
||||||
|
|
||||||
|
|
||||||
|
logpath='/var/log/httpd/'
|
||||||
|
basedest="/srv/people/site/accesslogs/"
|
||||||
|
logfn='fedorapeople.org-access.log'
|
||||||
|
search="$1"
|
||||||
|
destpath="$basedest/$2"
|
||||||
|
dstamp=`date -d yesterday +%Y-%m-%d`
|
||||||
|
|
||||||
|
# basedest
|
||||||
|
if [ ! -d $basedest ]; then
|
||||||
|
mkdir -p $basedest
|
||||||
|
chown apache.apache $basedest
|
||||||
|
chmod 770 $basedest
|
||||||
|
fi
|
||||||
|
|
||||||
|
#make sure there is an index.html up one so you can't find it
|
||||||
|
if [ ! -f $basedest/index.html ]; then
|
||||||
|
echo "nothing to see" > $basedest/index.html
|
||||||
|
chmod 664 $basedest/index.html
|
||||||
|
fi
|
||||||
|
|
||||||
|
#make the destpath
|
||||||
|
if [ ! -d $destpath ]; then
|
||||||
|
mkdir -p $destpath
|
||||||
|
chown apache.apache $destpath
|
||||||
|
chmod 770 $destpath
|
||||||
|
fi
|
||||||
|
|
||||||
|
# grab the logs
|
||||||
|
grep $search $logpath/${logfn}-${dstamp} >> ${destpath}/${dstamp}.log
|
||||||
|
chown apache.apache $destpath/${dstamp}.log
|
||||||
|
chmod 640 $destpath/${dstamp}.log
|
||||||
|
|
||||||
|
# clean up the old logs
|
||||||
|
/usr/sbin/tmpwatch -f 720 -m $destpath
|
|
@ -176,3 +176,13 @@
|
||||||
file: state=link src=/project dest=/srv/groups
|
file: state=link src=/project dest=/srv/groups
|
||||||
tags:
|
tags:
|
||||||
- people
|
- people
|
||||||
|
|
||||||
|
- name: setup script to grab download stats for some groups.
|
||||||
|
copy: src=grab-daily-logs.sh dest=/usr/local/bin/grab-daily-logs.sh mode=0755
|
||||||
|
tags:
|
||||||
|
- people
|
||||||
|
|
||||||
|
- name: setup cron job to gather download stats
|
||||||
|
copy: src=grab-daily-logs.cron dest=/etc/cron.d/grab-daily-logs mode=0644
|
||||||
|
tags:
|
||||||
|
- people
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue