~ubuntu-branches/ubuntu/oneiric/sysvinit/oneiric-proposed

« back to all changes in this revision

Viewing changes to debian/src/initscripts/etc/init.d/umountroot

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2011-12-12 16:08:10 UTC
  • Revision ID: package-import@ubuntu.com-20111212160810-rc37dpkyb8kf3t1z
Tags: 2.88dsf-13.10ubuntu4.1
* d/src/initscripts/etc/init.d/sendsigs: wait up to 300 extra
  seconds for upstart jobs that have been killed. They will be sent
  SIGKILL by upstart when their 'kill timeout' has been reached, so
  we should trust the job's author to give the service a reasonable
  amount of time to shut down. (LP: #688541)
* also omit pids of stop/killed upstart jobs since we know they've
  been killed already.
* d/src/initscripts/etc/init.d/umountroot: Check for init.upgraded
  file in /var/run before clearing out /var/run. (LP: #886439)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
do_stop () {
18
18
        [ "$VERBOSE" = no ] || log_action_begin_msg "Mounting root filesystem read-only"
 
19
        # Ask init to re-exec itself before we go down if it has been
 
20
        # upgraded this cycle.  It'll lose all its state, but at least
 
21
        # it won't hold open files on the root filesystem (lp:#672177).
 
22
        if [ -f /var/run/init.upgraded ]
 
23
        then
 
24
                old_map=$( cat /proc/1/maps )
 
25
                map=$old_map
 
26
                telinit u || :
 
27
                i=0
 
28
                timeout=5
 
29
                while [ "$map" = "$old_map" ]
 
30
                do
 
31
                        sleep 1
 
32
                        map=$( cat /proc/1/maps )
 
33
                        /usr/bin/logger "waiting for init to respawn"
 
34
                        i=$((i+1))
 
35
                        if [ $i -eq $timeout ] ; then
 
36
                                break
 
37
                        fi
 
38
                done
 
39
 
 
40
                if [ "$map" = "$old_map" ] ; then
 
41
                        /usr/bin/logger "FAIL: init failed to respawn in $timeout seconds - unmounting anyway"
 
42
                else
 
43
                        /usr/bin/logger "SUCCESS: init respawned after $i seconds (within $timeout seconds timeout)"
 
44
                fi
 
45
        fi
 
46
 
19
47
        # These directories must exist on the root filesystem as they are
20
48
        # targets for system mountpoints.  We've just unmounted all other
21
49
        # filesystems, so either they are mounted now (in which case the
49
77
            ln -nsf /run /lib/init/rw
50
78
        fi
51
79
 
52
 
        # Ask init to re-exec itself before we go down if it has been
53
 
        # upgraded this cycle.  It'll lose all its state, but at least
54
 
        # it won't hold open files on the root filesystem (lp:#672177).
55
 
        if [ -f /var/run/init.upgraded ]
56
 
        then
57
 
                old_map=$( cat /proc/1/maps )
58
 
                map=$old_map
59
 
                telinit u || :
60
 
                i=0
61
 
                timeout=5
62
 
                while [ "$map" = "$old_map" ]
63
 
                do
64
 
                        sleep 1
65
 
                        map=$( cat /proc/1/maps )
66
 
                        /usr/bin/logger "waiting for init to respawn"
67
 
                        i=$((i+1))
68
 
                        if [ $i -eq $timeout ] ; then
69
 
                                break
70
 
                        fi
71
 
                done
72
 
 
73
 
                if [ "$map" = "$old_map" ] ; then
74
 
                        /usr/bin/logger "FAIL: init failed to respawn in $timeout seconds - unmounting anyway"
75
 
                else
76
 
                        /usr/bin/logger "SUCCESS: init respawned after $i seconds (within $timeout seconds timeout)"
77
 
                fi
78
 
        fi
79
 
 
80
80
        MOUNT_FORCE_OPT=
81
81
        [ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f
82
82
        # This: