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

Revision 25439, 1.5 KB checked in by kaduk, 13 years ago (diff)
In reactivate: * Save lots of debugging information if we are rebooting in reactivate. It will go to athena-reactivate.log for later forensics.
  • 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
10print_processes_info() {
11  echo "BEGIN PRINT_PROCESS_INFO"
12  pstree -alcnpu
13  ps eauxwww
14  schroot --list
15  LC_ALL=C lsof -b +c 0 -w
16  echo "END PRINT_PROCESS_INFO"
17}
18
19set -e
20exec >>/var/log/athena-reactivate 2>&1
21
22# Stop any daemons that were specifically started inside the
23# chroot
24for daemon in $daemons; do
25  invoke-rc.d $daemon restart || [ $? = 100 ]
26done
27
28# schroot has already attempted to kill everything inside the chroot,
29# fairly thoroughly. Our job here is to determine if anything is stuck
30# after a kill -9, and reboot.
31for i in /var/lib/schroot/mount/*; do
32  if mountpoint -q "$i"; then
33    touch /var/run/reboot-required
34    echo "rebooting due to active mountpoint $i"
35    print_processes_info
36    break
37  fi
38done
39if [ -n "$USER" -a "$USER" != root ]; then
40  if pgrep -u "$USER"; then
41    echo "rebooting due to live user processes"
42    print_processes_info
43    touch /var/run/reboot-required
44  fi
45fi
46
47# Cleanup our ticketenv hack
48# Make sure nobody was evil
49chattr -f -i /tmp/ticketenv || :
50# If you made a directory and stored files there, too bad
51rm -rf /tmp/ticketenv
52
53# If either we or an updated package wanted to reboot, now is a
54# perfectly good time to do so -- auto-update is inhibited during a
55# login session.
56if [ -e /var/run/reboot-required ]; then
57  reboot
58fi
Note: See TracBrowser for help on using the repository browser.