]> mj.ucw.cz Git - moe.git/blob - mop/admin/mo-grab.sh
Moving things around, WIP batch tasktype via hooks
[moe.git] / mop / admin / mo-grab.sh
1 #!/bin/bash
2 # Grab all submits from contestants' home directories located on the
3 # local machine and copy them to solutions/.
4
5 [ -n "$1" ] || { echo "Usage: mo-grab <tasks>" ; exit 1 ; }
6 [ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; }
7 set -e
8 . cf/mop
9
10 for user in `bin/mo-get-users` ; do
11         echo -n "$user:"
12         H=`eval echo ~$user`/.submit
13         if [ -d $H ] ; then
14                 [ -d solutions/$user ] || mkdir -p solutions/$user
15                 for t in $@ ; do
16                         rm -rf solutions/$user/$t
17                         if [ -d $H/$t ] ; then
18                                 echo -n " $t"
19                                 cp -dr $H/$t solutions/$user/$t
20                         fi
21                 done
22                 echo
23         else
24                 echo " ---"
25         fi
26 done
27 chown -R $EVAL_USER solutions
28 chmod -R a+r solutions