Top link
Tools used for performing maintenance on the gaol environment
Tools used for performing maintenance on the gaol environment.

VirtualExam (vx)
Tools

Tools found in /home/virtualexam/bin

The tools/scripts listed here are run on a backend exam server and must be run as root. They only have to do with gaols established on that particular backend exam server. They do not affect the goals on other backed exam servers.

list_gaols

Lists the gaols on the server. The output will look something like this:

vx1 # ./list_gaols
Location                 UID
/var/gaol/z-vx1-10444    910444
/var/gaol/z-vx1-2082     902082
/var/gaol/z-vx1-2566     902566
/var/gaol/z-vx1-9972     909972

Note that the above was generated from gaols started using autologin. Gaols would more typically have names following the zID pattern of a 'z' followed by seven digits.

list_gaol_mounts

Because gaols environments are built largely by mounting things in the gaol (such as /dev, etc.), it can be very useful at times to know what things are currently mounted in the gaol, particularly when a gaol is somehow broken and you're cleaning up the pieces. list_gaol_mounts does that.

You give it the zID of a particular gaol, say one listed by list_gaols, and it gives you something like this:

vx1 # ./list_gaol_mounts z-vx1-10444

Listing in-gaol mount points ...
/var/gaol/z-vx1-10444/var/lib/dbus
/var/gaol/z-vx1-10444/usr/share
/var/gaol/z-vx1-10444/usr/lib
/var/gaol/z-vx1-10444/usr/include
/var/gaol/z-vx1-10444/proc
/var/gaol/z-vx1-10444/lib
/var/gaol/z-vx1-10444/home/z-vx1-10444
/var/gaol/z-vx1-10444/home/class
/var/gaol/z-vx1-10444/etc/ssl
/var/gaol/z-vx1-10444/etc/fonts
/var/gaol/z-vx1-10444/etc/dbus-1
/var/gaol/z-vx1-10444/etc/alternatives
/var/gaol/z-vx1-10444/dev/pts
/var/gaol/z-vx1-10444/dev

These are all the locations in the goal at which something is mounted.

delete_gaol

Deleting a gaol is something which must be done carefully because, as mentioned elsewhere, if you get it wrong you can end up deleting parts of the backend exam server's own file system as well.

delete_gaol does the right thing. You give it the zID of a gaol and it first makes all the gaol user's processes go away, does the necessary umounts and then makes the user's gaol environment itself go away. It does not tamper with the user's/student's home directory kept in the class exam account.

You use it like this:

vx1 # ./delete_gaol z-vx1-10354

User ID = 910354
Goal location = /var/gaol/z-vx1-10354

Current processes belonging to this user:
  PID COMMAND
10428 startup
10429 startup-session
10430 fvwm2
14187 sh
15228 sh
15229 make
15230 gcc
15232 cc1
15233 as
15980 build_tcl_cycle
24845 xterm
24847 bash
28483 make
Killing PIDs: 10428 10429 10430 14187 15228 15229 15230 15232 15233 15980 24845 24847 28483

Unmounting in-gaol mount points ...
Unmounting /var/gaol/z-vx1-10354/var/lib/dbus ...
Unmounting /var/gaol/z-vx1-10354/usr/share ...
Unmounting /var/gaol/z-vx1-10354/usr/lib ...
Unmounting /var/gaol/z-vx1-10354/usr/include ...
Unmounting /var/gaol/z-vx1-10354/proc ...
Unmounting /var/gaol/z-vx1-10354/lib ...
Unmounting /var/gaol/z-vx1-10354/home/z-vx1-10354 ...
Unmounting /var/gaol/z-vx1-10354/home/class ...
Unmounting /var/gaol/z-vx1-10354/etc/ssl ...
Unmounting /var/gaol/z-vx1-10354/etc/fonts ...
Unmounting /var/gaol/z-vx1-10354/etc/dbus-1 ...
Unmounting /var/gaol/z-vx1-10354/etc/alternatives ...
Unmounting /var/gaol/z-vx1-10354/dev/pts ...
Unmounting /var/gaol/z-vx1-10354/dev ...

Deleting everything else (including top-level gaol directory) ...

Done

delete_all_gaols

delete_all_gaols is rather heavy-handed. A bit like delete_gaol above, it kills all gaol users' processes on the backend exam server on which it is run, unmounts everything mounted in any gaol on that same server, and then deletes all gaol environments on the server.

quit_all_wm

Problem: the exam is over and many users have walked away without quitting. How do we clean up?

The normal trigger for a goal to shut itself down tidily is the exiting of the window manager in the user's X11 session. We can't easily manipulate the user's actual window manager and make it exit, but we can do some window manager magic and replace their window manager remotely with a new one which quits straight away. This will do the trick, especially if we do it for all gaols on a backend exam server.

Have a look at the comments in the script for full details.