what needs to be restarted
November 3, 2009
A common problem I’ve encountered for years is how to know what daemons need to be restarted in order to take advantage of some update or to be sure that they are running the secure version of the libs you just updated. I was thinking about this yesterday and realized I had all the tools necessary to find this out.
I came up with this simple script: needs_to_be_restarted.py
Now, it might be a bit overly simple and that is why I’m asking here. All it does is go through each of the processes in /proc/###### open the smaps file and look for files. For any of the files in there, it checks if a pkg owns them. If it does it checks what the installtime is on that package. If the installtime of the package is newer than when the process was started then it reports that pid (and the cmdline).
Now, this won’t work in every case, and I may have it report if the files have been removed but it seems to work pretty well.
If there are more foolproof ways to know or additional checks I should add, let me know.
If this looks good I’ll probably add some options and add it to yum-utils.