source: trunk/debathena/config/reactivate/debian/reactivate @ 24149

Revision 24149, 1.1 KB checked in by geofft, 15 years ago (diff)
reactivate: Restructure to make post-session cleanup easier. In addition, work with auto-update to lock out concurrent login sessions and updates, so as to reboot either if there was a package update requiring a reboot or if the login session cannot be cleaned up.
  • Property svn:executable set to *
Line 
1#!/bin/bash
2#
3# Cleans up after a login snapshot to make the machine ready for the
4# next login.
5#
6# This script may choose to reboot the machine in order to clear
7# user processes or processes using the login snapshot, although
8# that circumstance should be fairly rare.
9
10set -e
11exec >>/var/log/athena-reactivate 2>&1
12
13# Stop any daemons that were specifically started inside the
14# chroot
15for daemon in $daemons; do
16  invoke-rc.d $daemon restart || [ $? = 100 ]
17done
18
19# schroot has already attempted to kill everything inside the chroot,
20# fairly thoroughly. Our job here is to determine if anything is stuck
21# after a kill -9, and reboot.
22for i in /var/lib/schroot/mount/*; do
23  if mountpoint -q "$i"; then
24    touch /var/run/reboot-required
25    break
26  fi
27done
28if [ -n "$USER" -a "$USER" != root ]; then
29  if pgrep -u "$USER"; then
30    touch /var/run/reboot-required
31  fi
32fi
33
34# If either we or an updated package wanted to reboot, now is a
35# perfectly good time to do so -- auto-update is inhibited during a
36# login session.
37if [ -e /var/run/reboot-required ]; then
38  reboot
39fi
Note: See TracBrowser for help on using the repository browser.