3 # invoke this as root on mire
7 # drop any tokens; use only users' cgi tokens
8 kdestroy
> /dev
/null
2>&1
14 LOCAL_LOG_DIR
=/var
/log
/apache
2/user
15 KEYTAB_DIR
=/etc
/keytabs
/user.daemon
16 AFS_USER_DIR
=/afs
/hcoop.net
/user
19 # Sanify permissions so that we can safely create tmp directories and
21 chmod -R u
=rwX
,g
=rX
,o
=X
$LOCAL_LOG_DIR
23 # Iterate through logs for each user
24 for A
in $
(find $LOCAL_LOG_DIR -mindepth 3 -maxdepth 3 -print); do
26 PATHBITS
=`echo $USER | head -c 1`/`echo $USER | head -c 2`/$USER
28 LOG_DEST
=$AFS_USER_DIR/$PATHBITS/.logs
/apache
/
31 # Skip deleted or empty log directories
32 if test ! -d "$LOG_SRC" ||
! ls "$LOG_SRC"/*/*/*.log
>/dev
/null
2>&1; then
36 if test "$VERBOSE" = "true"; then
38 echo "=============================================================================="
39 echo "syncing logs for $USER from $A"
40 echo " to $LOG_DEST ..."
43 if test ! -d "$LOG_DEST"; then
44 echo "Error: $LOG_DEST does not exist, please make it"
48 cp -r $LOG_SRC $TMP_DEST
49 chown
-R $USER:nogroup
$TMP_DEST
50 chmod -R u
=rwX
,go
=X
$TMP_DEST
51 k5start
-qtU -f $KEYTAB_DIR/$USER \
52 -- su
$USER -c "rsync -a $TMP_DEST/ $LOG_DEST/"
54 test "$VERBOSE" = "true" && echo " done."
58 if test "$ERROR" = "yes"; then