~ubuntu-branches/ubuntu/precise/sysvinit/precise-updates

« back to all changes in this revision

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

  • Committer: Clint Byrum
  • Date: 2011-12-13 00:16:29 UTC
  • Revision ID: clint@ubuntu.com-20111213001629-aqbfb9923ohygn9r
* 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:
22
22
        /usr/share/apport/unkillable_shutdown $OMITPIDS
23
23
}
24
24
 
 
25
upstart_killed_jobs () {
 
26
        initctl list | grep 'stop/killed'
 
27
}
 
28
 
25
29
upstart_jobs () {
26
 
        initctl list | grep start/ | sed -n -e "/process [0-9]/s/.*process //p"
 
30
        initctl list | grep -E '(start/|stop/killed)' | sed -n -e "/process [0-9]/s/.*process //p"
27
31
}
28
32
 
29
33
do_stop () {
106
110
 
107
111
                sleep 1
108
112
        done
 
113
 
 
114
        # Upstart has a method to set a kill timeout and so the job author
 
115
        # may want us to wait longer than 10 seconds (as in the case of 
 
116
        # mysql). (LP: #688541)
 
117
        #
 
118
        # We will wait up to 300 seconds for any jobs in stop/killed state. 
 
119
        # Any kill timeout higher than that will be overridden by the need 
 
120
        # to shutdown. NOTE the re-use of seq from above, since we already 
 
121
        # waited up to 10 seconds for them.
 
122
        while [ -n "$(upstart_killed_jobs)" ] ; do
 
123
                seq=$(($seq+1))
 
124
                if [ $seq -ge 300 ] ; then
 
125
                        break
 
126
                fi
 
127
                
 
128
                sleep 1
 
129
        done
 
130
 
109
131
        if [ -z "$alldead" ] ; then
110
132
            #report_unkillable
111
133
            log_action_begin_msg "Killing all remaining processes"