Actually... That's an excellent suggestion. Except: the last command in a .xinitrc or .xsession file must stay runningfor the duration of the X session. Normally, that command is "kdeinit" or "gnome-session", or historically, the window manager executable i.e. "mwm" or "twm" or whatever.
If you start GNOME, say, by including "gnome-session &" as the second-last line, the *last* line can then be "sleep 1800". When it exits, so does the X session.
(It might be nice to provide a countdown timer for the user.)
-Adam