~ubuntu-branches/ubuntu/natty/unattended-upgrades/natty

« back to all changes in this revision

Viewing changes to unattended-upgrade-shutdown

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2011-03-14 11:49:02 UTC
  • mfrom: (4.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110314114902-ptzfspz42t7s6287
Tags: 0.70ubuntu1
* merged lp:~mvo/unattended-upgrades/minimal-steps-upgrade
  - This allows performaing the upgrades in minimal chunks so
    that they can be interrupted (relatively) quickly with
    SIGUSR1
  - This feature is not enabled by default yet, in order
    to use it, uncomment the line in 50unattended-upgrades:
     Unattended-Upgrades::MinimalSteps "true";
  LP: #729214

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
import apt_pkg
28
28
import time
 
29
import signal
29
30
import sys
30
31
import logging
31
32
import logging.handlers
85
86
        if res > 0:
86
87
            logging.debug("Lock not taken")
87
88
            sys.exit(0)
 
89
        # signal unattended-upgrades to stop
 
90
        p = "/var/run/unattended-upgrades.pid"
 
91
        if os.path.exists(p):
 
92
            pid = int(open(p).read())
 
93
            os.kill(pid, signal.SIGUSR1)
88
94
        # wait a some seconds and try again
89
95
        msg = _("Unattended-upgrade in progress during shutdown, "
90
96
                "sleeping for 5s")