# This was already so tagged, but I don't know why. # Jeers to the fool that did it. tag 264985 patch thanks
Attached is a patch fixing checkrestart; I'm not particularly proud of the gratuitous loops, but I haven't claimed to know python... --- /usr/sbin/checkrestart 2006-11-02 18:53:49.000000000 -0500 +++ /tmp/checkrestart 2006-12-15 21:12:53.000000000 -0500 @@ -12,13 +12,17 @@ def main(): process = None processes = {} - for line in os.popen('lsof +L1 -F n').readlines(): + for line in os.popen('lsof +XL -F nf').readlines(): field, data = line[0], line[1:-1] if field == 'p': process = processes.setdefault(data,Process(int(data))) + elif field == 'k': + process.links.append(data) elif field == 'n': process.files.append(data) + elif field == 'f': + process.descriptors.append(data) toRestart = filter(lambda process: process.needsRestart(), processes.values()) @@ -101,6 +105,8 @@ def __init__(self, pid): self.pid = pid self.files = [] + self.descriptors = [] + self.links = [] try: self.program = self.cleanFile(os.readlink('/proc/%d/exe' % self.pid)) @@ -117,8 +123,16 @@ def needsRestart(self): for f in self.files: - if f.endswith('.dpkg-new'): - return 1 + if f.endswith(' (deleted)'): + return 1 + if re.compile("\(path inode=[0-9]+\)$").search(f): + return 1 + for f in self.descriptors: + if re.compile("DEL").search(f): + return 1 + for f in self.links: + if f == 0: + return 1 return 0 class Package: Here's some sample output: 21:16:43 up 135 days, 6:06, 1 user, load average: 0.08, 0.03, 0.00 Found 47 processes using old versions of upgraded files (24 distinct programs) (23 distinct packages) Of these, 11 seem to contain init scripts which can be used to restart them: /etc/init.d/apt-index-watcher restart /etc/init.d/cron restart /etc/init.d/atd restart /etc/init.d/mysql-ndb-mgm restart /etc/init.d/mysql restart /etc/init.d/mysql-ndb restart /etc/init.d/gdm restart /etc/init.d/sysklogd restart /etc/init.d/klogd restart /etc/init.d/dbus-1 restart /etc/init.d/ssh restart /etc/init.d/ntp restart /etc/init.d/openbsd-inetd restart Here are the others: kdelibs4c2a: 17826 /usr/bin/kdeinit 17830 /usr/bin/kdeinit 17831 /usr/bin/kdeinit 17825 /usr/bin/kdeinit 17849 /usr/bin/kdeinit 17846 /usr/bin/kdeinit 17828 /usr/bin/kdeinit 8455 /usr/bin/kdeinit 17811 /usr/bin/kdeinit 17816 /usr/bin/kdeinit 17814 /usr/bin/kdeinit 17818 /usr/bin/kdeinit 17837 /usr/bin/kdeinit 17823 /usr/bin/kwrapper xserver-xorg-core: 5062 /usr/bin/Xorg util-linux: 5083 /sbin/getty 5082 /sbin/getty 5081 /sbin/getty 5086 /sbin/getty 5085 /sbin/getty 5084 /sbin/getty openssh-client: 17784 /usr/bin/ssh-agent 17783 /usr/bin/ssh-agent libarts1c2a: 11614 /usr/bin/artsd 19565 /usr/bin/artsd kscd: 17840 /usr/bin/kscd xprint: 8897 /usr/bin/Xprt kteatime: 17841 /usr/bin/kteatime korganizer: 17850 /usr/bin/korgac bash: 17702 /bin/bash konqueror: 11629 /usr/bin/konqueror amor: 11626 /usr/bin/amor -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]