Looking for a homework submission script.
May 18, 2006 12:45 PM   Subscribe

Where can I find a simple UNIX homework submission script?

I'm looking for a simple, secure, script that will allow students to type "submit file1 file2 file3" and the files will be packaged up and copied to an appropriate directory. Google turns up the homepages of a lot of courses telling their students to use a script like this, but I'm unable to find the actual program. Thanks!
posted by event to Computers & Internet (13 answers total)
 
Or add the date and time to the filename.
posted by smackfu at 1:01 PM on May 18, 2006


Also, it might help in your googling that these are also called "turnin scripts".
posted by smackfu at 1:03 PM on May 18, 2006


this framework was always a semester project for a grad student 10 years ago and reused until the process needed to be repeated. just FYI - at least with programming assignment submission scripts.
posted by kcm at 1:09 PM on May 18, 2006


The thing to do is probably make a program (not script) that will accept the files on the command line, copy them to a given directory and email you the event (so you know if anyone tries any funny business). Make the directory readable/writable only to you and make the program setuid.
posted by Capn at 1:35 PM on May 18, 2006


If you've got root, you could do it by creating a directory for each student name and chowning that directory to the student's username - that way each student can read and write to their own directory and nobody else can. Then they can just cp or tar or whatever the stuff over, assuming it's on a network share.
posted by handee at 1:39 PM on May 18, 2006


I can't tell you where to find it, but I browsed through a submit script that works just like you describe (though there may be different implementations out there) when it was used at our university, and the one thing it was not was secure.
posted by fvw at 1:58 PM on May 18, 2006


I (re)wrote one of these for my university's cs department a few years ago. To get around the problem brought up by b1tr0t, I used sudo, but only su'd to root for the absolute minimum number of operations possible. sudo was setup such that only the script responsible for moving the files and changing ownership could be executed as root, and the script itself defended against any injection with a number of tactics. Our particular department wanted to be able to quickly add assignments organized by course and a menu-driven interface, so it may have been more complex than what you're looking for. If you just need to securely get files from students and do have root, handee's suggestion sounds like a quick and easy solution.

I could probably dig up the code for the one I did, but I wouldn't want to push my university's "WE OWN EVERYTHING YOU DID HERE EVER" policy. As other people have said, these are often homegrown, so you might want to contact someone at a nearby school with a cs dept.
posted by (lambda (x) x) at 2:19 PM on May 18, 2006


Response by poster: Thanks everyone for your help thus far. To clear up a few questions: I do not have root, and I am in fact the grad student who has been given the job of writing this framework anew.

I don't want to reinvent the wheel, and this is a wheel that looks like it's already been invented repeatedly. But while every school out there seems to have their own script, very few appear willing to put theirs where I can get a look at it.
posted by event at 2:40 PM on May 18, 2006


Sourceforge has a project called turnin, you can grab the latest alpha code from SVN.
posted by tumble at 3:42 PM on May 18, 2006


Everyone knows webservices are the way of the future. the entirely correct way to do this would be to write a SOAP/XML webservice and a SOAP client in Java to submit the homework (binary files using attachments, natch).

In all seriousness, just set up a directory on a network share, chown each subfolder to the particular user, and write a quick script using cp.
posted by devilsbrigade at 7:32 PM on May 18, 2006


OK you've not got chown as you've not got root. Here's a quick and dirty script that is probably worth getting someone else to check for holes as I did it in 15 minutes just now. Should be fairly obvious what it does - the student types submit filename.doc and everything else should just happen. Permissions will be a problem but I'm sure you can play around with them until you get something reasonable:
#/bin/bash

email="your_email_address"; #change this
record_file="/tmp/submissions"; #change this
submission_directory="/tmp/"; # change this for each coursework
filename=$1; # the first argument to the script
current_path=$(pwd); # store current location
student_username=$(whoami);
date_string=$(date +%b.%d.%k.%M.%N);

unique_string=$date_string.$student_username;

cd $submission_directory;
if test -d $student_username ; then
   $(cp $current_path/$filename $student_username/$unique_string);
   echo "Submitting additional file";
   echo $unique_string >> $record_file; #append string to record of
                                        #submissions
else 
   echo "Creating directory for first submission";
   $(mkdir $student_username);
   echo "Making first submission";
   $(cp $current_path/$filename $student_username/$unique_string);
   echo $unique_string >> $record_file; #append string to record of
                                        #submissions
fi

number_submissions=$(ls -1 $student_username | wc -l);

echo "You have now submitted $number_submissions attempts.";
echo "If this seems wrong to you please email $email.";

posted by handee at 2:26 AM on May 19, 2006


Contact Lyle Ungar at UPenn.edu - he has what you need.
posted by dmd at 8:05 AM on May 21, 2006


Response by poster: Thanks everybody for your time! I'm going to use some of the contacts and source code I've gotten from this thread to put together an open sourced submit program. I will post back here as things develop.
posted by event at 7:41 PM on May 21, 2006


« Older Two weeks or two months notice?   |   Time to Reclaim Part of my Garden. Newer »
This thread is closed to new comments.