Using Turn In via UNIX Command Line For Instructors


Overview


Turnin is a program which students use to hand in their homework assignments for a class via the Unix command line. The instructor has to make certain preparations for the use of turnin. Turnin works by copying a file into a special directory in the class umbrella. The directory is under the control of the instructor or TA. Assignment deadlines may be enforced. The instructors may then use these to evaluate the assignments on a set deadline. 

Turnin works well in situations where students only need to hand in one file per assignment. In more complex situations, for example where students are required to hand in a a set of files or a directory hierarchy, there is an instructor configurable utility called Bundle which acts as a front-end to turnin.

Critical Concepts


Steps to Take


Creating the Destination Directory

In order to allow your students to use the "turnin" program to hand in homework assignments, you will need to create the destination directory. This directory should be called "turnin.dest" and must exist in the class directory umbrella, and must be owned by the instructor's account (not a TA account). To create the directory, you should log into the instructor's account and issue the following commands:

cd ~/..
mkdir turnin.dest
chmod o-rwx turnin.dest

The first command puts you at the root level of the umbrella. The second creates the turnin.dest directory. Finally, the third command ensures that the directory is not accessible by anyone except the instructor and the TA accounts. This prevents students from accessing files turned in by other students. Again, the turnin.dest directory must be owned and writable by the instructor's account. The ownership and permissions are verified by the turnin program.

Once the directory has been created, students may begin to use the "turnin" program to hand in assignments. The material submitted by each student will be placed in a file in turnin.dest. The file is named after the student's account.

As described in the information for students, turnin only stores one file per student. It is recommended that instructors setup the "bundle" mechanism in cases where a multifile capability is required. Alternatively, but with more complexity for students, they can use tar to create a tar archive and submit that with turnin.

Tar archives submitted by students may be examined using the "tv" options:

tar tvf jsmith

Before unpacking a tar archive it probably would be wise to create an empty directory and unpack the archive there to avoid name conflicts with files from other students.

mkdir from.jsmith
mv jsmith from.jsmith
cd from.jsmith
tar xvf jsmith

The sequence shown above creates a new directory "from.jsmith"; moves the "jsmith" tar archive into the new directory; does a change directory (cd) to the new directory; unpacks the archive (actually extracts copies of the contents leaving the archive intact).

Enforcing Deadlines

Some classes require that an assignment be handed in by a specific time after which homework is not accepted. The deadline can be rigidly enforced by simply renaming the turnin.dest directory to something else at the deadline. Since "turnin" won't be able to find the turnin.dest directory, files cannot be handed in.

To rename the directory to, say, "hwk1-files", use the "mv" command as follows:

cd ~/..
mv turnin.dest hwk1-files

The directory will be renamed to "hwk1-files" and students will be unable to turn in assignments.

If it is inconvenient to be logged on at the time of the deadline, use of the "at" command can allow you to rename the directory at the specified time even if you are not around to do it. Here's an example.

Let's say the deadline is Friday, January 25, at 9:00pm. You can use the "at" command to rename the turnin.dest directory to something else at exactly that moment.

cd ~/..
at 9pm jan 25

"at" will then prompt for the commands to be executed until you press CTRL-D. So, to rename the directory, continue by typing

mv turnin.dest hkw4-files
<CTRL-D>

This will set up a job that will be run at exactly 9:00pm on January 25 to rename the turnin.dest directory. See man at for more information about the format and usage of the "at" command.

An alternative to enforcing a rigid deadline by changing the directory name is simply to look at the timestamp on the turned-in file. If the date on the file is prior to the deadline, then the user was able to turn in their assignment before the deadline. It is not possible for the student to change the date on the turnin file.

Turnin Command Line Options (and running silently)

-c courseid
Specify the identifier (e.g. ec170f) for the course to which the assignment is being turned in.

The following two options are designed to support the "bundle" utility; they are not intended for direct use by students. The bundle Perl script illustrates how these options are employed.

-q
Run in query-only mode. No file is turned in. Query-mode reports parameters that the instructor may have configured for a project. Parameters include: start date and end date defining the period during which turnin is allowed, limit on maximum size of turned in file.

See "man turnin" for details about the format of project configuration files.

-p projectid
Specify a two character project identifier.

If the student already has a file in the turnin.dest directory, turnin normally will ask the student to confirm before overwriting the previously turned in file. If turnin is reading the assignment file from a pipe, then the request for confirmation is suppressed. This can be used to advantage in scripted applications of turnin where you do not want the student to be asked questions.

cat homework2 | turnin -c ec170f

If you also want to suppress turnin messages, use:

cat homework2 | turnin -c ec170f > /dev/null

Resolving Problems

While the error messages returned by turnin are generally descriptive enough to figure out what went wrong, some may need some further explanation. IMMEDIATELY after running turnin, type

echo $status

and match the number printed with the number in the left column here.

These error messages are numbered in chronological order -- that is, error 22 will occur later than error 21 would have. This may be useful for determining how far into the program the user got before it crashed.

Additionally, the error codes are grouped by severity: 0-19 represent general usage errors; 20-49 represent errors which likely point to incorrect "turnin" setup; and those above 50 represent internal errors which should be reported to ETS.

0
No error -- normal program exit status.
1
Error in usage. Make sure user is using the correct command line arguments.
2
No courseid was specified, nor was one available via PREPLABEL variable. Use the -c option to specify a courseid.
3
Unknown project name supplied on command line. Confirm that a valid project name was given.
If the "REQUIREPROJECTCONFIG" option has been set within the master CONFIG file, confirm that a CONFIG.<projname> file exists which corresponds to the supplied project name.
4
Turnin for this project (or for all projects) has been disabled via a CONFIG option. Check with your professor or TA.
5
User attempted to turn in a file larger than the MAXFILESIZE as configured in CONFIG and/or CONFIG.<projname>.
20
getpwnam(courseid) failed. Courseid was not found in the passwd file. You should verify that the supplied courseid is correct. Contact ACMS if you can't resolve the problem.
21
UID for courseid less than 500. This should not happen when a valid courseid is supplied. Contact ACMS if the problem persists.
22
Couldn't start the turnin.dest directory. Directory probably doesn't exist. This could happen if the user tries to submit a file after the deadline when, perhaps, the turnin.dest directory name has been changed to prevent further turnins.
23
Turnin.dest directory is not owned by courseid. Make sure the directory is owned by the instructor's account, not a TA's account.
24
Turnin.dest is not writable by courseid. Permissions on turnin.dest should be 770 (ie, fully accessible to instructor and TA, and not accessible to student).
25
Illegal project name supplied with "-p" option. Project names are limited to 10 characters from the set: A-Z, a-z, 0-9, and "-".
26
STDIN a TTY, yet no source filename supplied. Specify a filename on the turnin command line or use shell redirection. See the turnin documentation for more detailed instructions.
27
Unable to stat() the source file. Probably due to an invalid filename supplied on the command line.
28
Unable to open() the source file. File is probably unreadable by the calling user. See the message returned by perror() to determine the exact nature of the error.
29
Unable to open the destination file. Probably insufficient disk space or the course account has exceeded its quota. See the message returned by perror() to determine the exact nature of the error. Make sure the instructor's account has ample disk space for the turned-in files.
30
An error occurred trying to write the destination file. Probably a) exceeded quota, b) insufficient disk space. See the message returned by perror() to determine the exact nature of the error. Make sure the instructor's account has ample disk space for the turned-in files.
35
A syntax error was discovered in the master CONFIG file. The instructor or TA should check the reported filename/ line number and correct any errors.
36
A syntax error was discovered in the CONFIG.<projname> file. The instructor or TA should check the reported filename/ line number and correct any errors.
50
Failed in attempt to seteuid to root (uid 0). This can happen if the program is not setuid root. Contact ACMS.
51
Failed in attempt to setegid to course GID. This can happen if the program is not setuid root. Contact ACMS.
52
Failed in attempt to seteuid to course UID. This can happen if the program is not setuid root. Contact ACMS.
53
Failed in attempt to setegid to caller's GID. This can happen if the program is not setuid root. Contact ACMS.
54
Failed in attempt to seteuid to caller's UID. This can happen if the program is not setuid root. Contact ACMS.
55
An error occurred trying to read the source file. See the message returned by perror() to determine the exact nature of the error. Contact ACMS if source of the error isn't evident.
56
Umbrella directory name does not match courseid. Contact ACMS.
57
Failed in attempt to seteuid to callerid. This can happen if the program is not setuid root. Contact ACMS.</dd></dl>

If you still have questions or need additional assistance, please contact the ITS Service Desk. You can call us at (858) 246-4357, email us at support@ucsd.edu, or submit a ticket at support.ucsd.edu.