/usr/lib/wims/bin/housekeep.daily is in wims 4.01e-7.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | #! /bin/sh
# Home directory of wims.
cd `dirname $0`/..
WIMS_HOME=`pwd`
today=`date '+%Y%m%d'`
weekday=`date '+%w'`
thisyear=`date '+%Y'`
# Forum management
cd log/forums
./.build-index
cd $WIMS_HOME
if [ "$site_accounting" = "yes" ]; then bin/account.sh; fi
sleep 10
cd $WIMS_HOME
# TeX pictures and fonts since 90 days: atime can no longer be used.
find public_html/w/instex -name '*.gif' -mtime +90 -exec rm '{}' 2>/dev/null \;
find public_html/w/instex -type d -empty -exec rm '{}' 2>/dev/null \;
find public_html/w/texgif -name '*.font' -mtime +90 -exec rm '{}' 2>/dev/null \;
# Clean tmp directory
find tmp -maxdepth 1 -type f -mtime +2 -exec rm '{}' 2>/dev/null \;
find tmp/forall -mindepth 1 -mtime +2 -exec rm '{}' 2>/dev/null \;
mkdir -p tmp/forall
chmod a+rwx tmp/forall
# Any expired classes?
cd log/classes
for cls in [0-9]*
do
exp=`awk -F'=' '$1=="!set class_expiration" {print $2; exit}' $cls/.def`
if [ -z "$exp" ] || [ "$exp" -lt "$today" ]; then
email=`awk -F'=' '$1=="!set class_email" {print $2; exit}' $cls/.def`
inst=`awk -F'=' '$1=="!set class_institution" {print $2; exit}' $cls/.def`
desc=`awk -F'=' '$1=="!set class_description" {print $2; exit}' $cls/.def`
host=`hostname`
mail $w_mail_opt -s "WIMS virtual class expired" "$email" <<@
You have created a virtual class
$inst, $desc
(code $cls) on the site $host. This class is now closed,
because it has reached its expiration date.
The complete registry of this class (user list and activity history)
is stored in an archive file, which can be sent to you upon request
to the webmaster of this site.
--- WIMS (WWW Interactive Multipurpose Server)
http://$host/
@
echo "$today housekeep class-expire $cls: $email" >>$WIMS_HOME/log/mail.log
rm -R $cls/.parmreg >/dev/null 2>&1
if [ -d $WIMS_HOME/log/ccaccount/$cls ]; then
tar -cf $cls/account.tar -C $WIMS_HOME/log ccaccount/$cls 2>/dev/null
rm -R $WIMS_HOME/log/ccaccount/$cls 2>/dev/null
fi
mkdir -p $WIMS_HOME/backup/oldclasses/$thisyear
tar -czf $WIMS_HOME/backup/oldclasses/$thisyear/$cls.tgz $cls
rm -R $cls >/dev/null 2>&1
# clean resource sharing links
find . -maxdepth 2 -type l -lname '*/$cls/*' -exec rm '{}' \;
fi
done
# Clean up remaining classes.
cd $WIMS_HOME/log/classes
find . -path '*/.parmreg/*' -type f -exec rm -f '{}' \;
for l in `find . -name examlog -type d`; do
for d in $l/*; do
list=`ls -dt $d/* | tail +$examlog_lim2`
if [ -n "$list" ]; then echo rm -Rf $list; fi
done
done
# check if all compulsory directories are here (only in non example classes)
cd $WIMS_HOME/log/classes
list=`find [0-9][0-9][0-9][0-9][0-9]* -type d -maxdepth 0` ;
for s in $list ; do
for d in .users sheets exams doc score noscore vote cdt src def livret seq ; do
mkdir -p $s/$d
done
done
# Sheet expiration management. This should be activated during summer vacation.
for s in `find . -path '*/sheets/.sheets' -type f`; do
# quick test : any sheet to expire now ?
test=`awk 'BEGIN {a=0};
a==1 {a=0; if($1<'$today' && b==1) {print "Z"; exit}}
substr($1,1,1)==":" {a=1;b=substr($1,2,1)};' $s`
# if test then change status code to 2 for sheets to expire
# in temporary file, then overwrite old file with new one
if [ ! -z "$test" ]; then
awk 'BEGIN {a=0; v=0};
a==1 {a=0; if($1>='$today' || v!=1) {print t} else {print ":2"};}
substr($1,1,1)!=":" {print};
substr($1,1,1)==":" {a=1; t=$1; v=substr(t,2)};' $s >.sheets
mv -f .sheets $s
fi
done
# Build class index file
./.build-index
cd $WIMS_HOME/log
if [ -d ccaccount ]; then
for c in `cd ccaccount; ls -d [0-9]* 2>/dev/null`; do
if [ ! -d classes/$c ]; then rm -rf ccaccount/$c; fi
done
fi
# possible local housekeeping script
cd $WIMS_HOME
[ -x log/housekeep.local ] && log/housekeep.local
|