Setup your cron job as follows:


#group submissions run ever 4 hours during last 2 weeks of classes (must run on student.cs)
00 0,4,8,12,16,20 21-30 11 * ssh -x student.cs "/u/isg/bin/group_mgr-process_group_txt_submissions group"
00 0,4,8,12,16,20 1-5 12 * ssh -x student.cs "/u/isg/bin/group_mgr-process_group_txt_submissions group"

The above job expects that there is an assignment called group defined and that the only file accepted is a text file called group.txt, the contents of which is simply the members of the group, each on one line.

The contents of your course's .submitrc file filter should be something like this :

#!/bin/bash -
# ensure GNU commands on Solaris (and Linux)
export PATH=`/bin/showpath -PackageWarnings gnu standard`

#
# This program is called, as follows, for each file to be submitted
#
# file_filter <class> <asst_no> <username> <dir> <file>
#

class=${1}
asst_no=${2}
userid=`echo ${3} | cut -c1-8`          # max 8 characters
dir=${4}
pathname=${5}

maxsize=1048576
if [ "`wc -c ${pathname} | sed -e 's/[ ]*\([0-9]*\).*/\1/g'`" -gt ${maxsize} ] ; then  # file size > 1M ?
    echo -e "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    echo "file exceeds maximum size of ${maxsize} bytes. Check Content"
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    # file is rejected because output is generate
    exit 0
fi
file=`basename ${pathname}`

case ${file} in
  group.txt)
    /u/isg/bin/group_mgr-submit_file_filter ${class} ${asst_no} ${userid}
    ;;
  *txt)
#    file ${pathname} | grep -q -i 'ascii\|english\|text\|empty'
#    if [ "${?}" -ne 0 ] ; then         # did not find text
#        echo -e "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
#        echo "*txt files may only be in ASCII. Check Content"
#        echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
#        # file is rejected because output is generate
#       exit 0
#    fi

    lineCount=`fold -w120 ${pathname} | wc -l`
    maxlines=500
    if [ ${asst_no} -ge 6 ] ; then      # project gets more lines
        maxlines=750
    fi
    if [ ${lineCount} -gt ${maxlines} ] ; then
        echo -e "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
        echo "File \"${pathname}\" exceeds limit of ${maxlines} lines."
        echo "Use \"fold -w120 ${pathname} | wc -l\" to double-check."
        echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
        # file is rejected because output is generate
        exit 0
    fi
    ;;
  *)
    # accept file
    ;;
esac

exit 0

-- OmarNafees - 22 Nov 2011

Topic revision: r1 - 2011-11-22 - OmarNafees
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback