[Infrastructures] Best/good/non-sucky way to restart daemons when libs are updated?

John Borwick borwicjh@wfu.edu
Wed, 09 Mar 2005 09:15:01 -0500


This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigAE0456A849AEB781A8B0275F
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Joel Huddleston wrote:
> Quoting Wil Cooley <wcooley@nakedape.cc>:
>>Also Sprach DJ Gregor <dj@gregor.com> on Tue, Mar 08, 2005 at 10:24:37AM
>>PST:
>>
>>>You could run "ldd" on each of the daemons and check the update time on
>>>the libraries listed.
>>
>>That's a good start, but it would fail to take into consideration
>>dynamically-loaded modules, for which there is no solution other than
>>explictly listing.
> 
> Perhaps not... Instead of running ldd on each of the daemons, since they are in
> memory and any library they are using must be "open", you could use lsof to
> examine which libraries are currently mapped to memory. You could then check the
> mtime of library in the same way that you would for ldd. That should catch
> everything that is active.

What about running "fuser" on all the library files and get the 
corresponding process IDs using those files?  Something like

   find /usr/lib -type f -name '*.so*' -mtime -1 | xargs fuser \
     | perl -lne 'print $1 while /\s(\d+)/g' | sort -nu

would give you all the PIDs using files in /usr/lib that have been 
modified within the last day.

Yours,
John
-- 
            John Borwick
        System Administrator
       Wake Forest University | web  http://www.wfu.edu/~borwicjh
       Winston-Salem, NC, USA | GPG key ID             0x797326D5

--------------enigAE0456A849AEB781A8B0275F
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFCLwTo/81sF3lzJtURAvaIAJ41NxSKs+CgArhmWentZG4SmS0e2gCdFmdv
Nha9nEqq7UmB7cyetNIuK7o=
=rfPK
-----END PGP SIGNATURE-----

--------------enigAE0456A849AEB781A8B0275F--