services:labtest:old:custom_script

Custom Shell Script Execution on User Login (optional)

Labtest can run a custom shell script on login in order to initialize a student home directory. You can use this functionality to customize the account setup. The shell script must be called “labtest.sh” and must be located in the ltinit subdirectory of your labtest web directory (/eecs/dept/www/course/<COURSE>/labtest/ltinit/labtest.sh). Other files and directories in your ltinit directory are also automatically copied down to the student account as well. Your script can address these files and directories as well.

Let's assume a course of EECS9999. In the most basic case, let's say you have a folder called “a1” in /eecs/dept/www/course/EECS9999/labtest/ltinit/a1. You want this folder to be copied directly to the users home directory (not in the ltinit subdirectory). You would create /eecs/dept/www/course/EECS9999/labtest/ltinit/labtest.sh containing:

#!/bin/sh

cp -r ~/ltinit/a1 ~

Now let's assume you have a zip file called “project.zip” in /eecs/dept/www/course/9999/labtest/ltinit. You want to create a directory called “project” in the users home directory, and unzip project.zip into this directory. You would create /eecs/dept/www/course/EECS9999/labtest/ltinit/labtest.sh containing:

#!/bin/sh

mkdir ~/project
cd ~/project
unzip ~/ltinit/project.zip

In order to ensure that labtest.sh is executed when the user logs in, you must set the correct file group and permission:

chgrp labtest /eecs/dept/www/course/9999/labtest/ltinit/labtest.sh
chmod g=rx /eecs/dept/www/course/9999/labtest/ltinit/labtest.sh

If you are experimenting with this functionality for your course, please consult with tech. We can review your script with you before your test, and place a machine into labtest mode to check that it works the way you expect.

services/labtest/old/custom_script.txt · Last modified: 2018/10/02 11:11 by 127.0.0.1