May 3, 2012
tom

Determining the version of a packaged process on linux

Question

It’s easy to know which version of a package is installed on a linux distro:

package-manager info <packagename>

i.e.:

yum info ntp

However, is there a ‘linux convention’ sort of way to know what the package version of a running process is?

The potential situation is that the act of just installing a package is not a guarantee that a process started by it is stopped and restarted (it’s a common convention; but no guarantee!). So, I’m curious if there is a way to ascertain the version of the process… which is not necessarily the version of the package currently installed that made the process available.

Asked by sethcall

Answer

I believe you are looking for something similar to the checkrestart tool which is part of the debian-goodies package. It basically uses looks at all the running processes and determines if they are referring to deleted files. It then correlates this to the package names by searching for the files in the package database. Then it tells you which services need to be restarted.

If you aren’t running a Debian based distribution, then I suspect you could download the source (python) and try to adapt the tool to your environment. Or you could just figure out what it is doing and call lsof directly.

Here is a version somebody created for Gentoo.

Answered by Zoredache

No related posts.

Leave a comment