#!/bin/sh # Services that are running outdated libraries # Requires needrestart (Debian, Ubuntu, Linux Mint) or needs-restarting (Fedora Linux, Rocky Linux, AlmaLinux) if [ "$(id -u)" -ne 0 ]; then echo "requires root, run with sudo" >&2 exit 1 fi if command -v needrestart > /dev/null 2>&1; then services=$(needrestart -b -r l 2> /dev/null | sed -n 's/^NEEDRESTART-SVC: //p') elif command -v dnf > /dev/null 2>&1; then services=$(DBUS_STARTER_BUS_TYPE=system dnf -C -q needs-restarting -s) || exit else echo "needrestart or dnf not found, install the needrestart package" >&2 exit 1 fi if [ -n "$services" ]; then echo "$services" | paste -sd ',' - | sed 's/,/, /g' else echo "None" fi