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 | |
---|
10 | set -e |
---|
11 | exec >>/var/log/athena-reactivate 2>&1 |
---|
12 | |
---|
13 | # Stop any daemons that were specifically started inside the |
---|
14 | # chroot |
---|
15 | for daemon in $daemons; do |
---|
16 | invoke-rc.d $daemon restart || [ $? = 100 ] |
---|
17 | done |
---|
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. |
---|
22 | for i in /var/lib/schroot/mount/*; do |
---|
23 | if mountpoint -q "$i"; then |
---|
24 | touch /var/run/reboot-required |
---|
25 | break |
---|
26 | fi |
---|
27 | done |
---|
28 | if [ -n "$USER" -a "$USER" != root ]; then |
---|
29 | if pgrep -u "$USER"; then |
---|
30 | touch /var/run/reboot-required |
---|
31 | fi |
---|
32 | fi |
---|
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. |
---|
37 | if [ -e /var/run/reboot-required ]; then |
---|
38 | reboot |
---|
39 | fi |
---|
Note: See
TracBrowser
for help on using the repository browser.