cvs sucks even more
[clinton/scripts.git] / apache-sync-logs
1 #!/bin/bash
2
3 # invoke this as root on mire
4
5 exec 2>&1
6
7 # drop any tokens; use only users' cgi tokens
8 kdestroy
9 unlog
10
11 LOCAL_LOG_DIR=/var/log/apache
12
13 for A in $LOCAL_LOG_DIR/user/?/??/*; do \
14 USER=`basename $A`
15 PATHBITS=`echo $USER | head -c 1`/`echo $USER | head -c 2`/$USER
16 LOG_DEST=/afs/hcoop.net/user/$PATHBITS/logs/apache/
17
18 echo
19 echo "=============================================================================="
20 echo "syncing logs for $USER from $A to $LOG_DEST ..."
21
22 chown -R $USER:www-data $A
23 chmod -R ug+rw $A
24
25 k5start -tU -f /etc/keytabs/cgi/$USER \
26 -- su $USER -c "rsync -a $A/ $LOG_DEST/"
27 done