Upgraded your system? Don't know what services to restart?
I wrote a small computer program that helps you with that.
As of today, I have released needs-restart
— a very simple software program that detects which programs you're running need to be restarted after an upgrade.
Its principle of operation is simple: if any process on your system has mmap()
ed a file for execution purposes, and that file has been deleted or replaced with a new file, my program will classify that process as in need of being restarted. Additionally, it will classify the output based on which service that process belong to, further simplifying the work of discovering which services need to be restarted.
Example output follows:
[root@machine root]# needs-restart * unit: (no unit) * PID: 1 command: /usr/lib/systemd/systemd --switched-root --system... * /usr/lib64/libpcre.so.1.2.5 changed inode from 5305 to 5364 * unit: systemd-journald.service * PID: 257 command: /usr/lib/systemd/systemd-journald * /usr/lib64/libpcre.so.1.2.5 changed inode from 5305 to 5364 * unit: systemd-udevd.service * PID: 281 command: /usr/lib/systemd/systemd-udevd * /usr/lib64/libpcre.so.1.2.5 changed inode from 5305 to 5364 * unit: auditd.service * PID: 318 command: /sbin/auditd -n * /usr/lib64/libpcre.so.1.2.5 changed inode from 5305 to 5364 * unit: icecast.service * PID: 336 command: /usr/bin/icecast -c /etc/icecast.xml * /usr/lib64/libpcre.so.1.2.5 changed inode from 5305 to 5364 * /usr/lib64/libnss3.so changed inode from 3183 to 4236 * /usr/lib64/libsmime3.so changed inode from 17534 to 4257 * /usr/lib64/libssl3.so changed inode from 17535 to 4259
As you can see, it's pretty straightforward. It also sports several options:
- An option
-b
that suppresses the verbose output and shows you only the service names to restart. - An option
-s
that suppresses showing services and processes that aren't part of a system service (user sessions, scopes, et cetera). - Another option
-i
that tells the classifier to ignore files modified in certain paths.