I want to automatically restart them. This script does not work:
FILE_PATH="/etc/needrestart/needrestart.conf"# Check if the file existsif [ -f "$FILE_PATH" ]; then # Use sed to replace 'i' with 'a' for the specific configuration sudo sed -i "s/\$nrconf{restart} = 'i';/\$nrconf{restart} = 'a';/g" "$FILE_PATH" echo "The file has been updated successfully."else echo "The specified file does not exist."fi
I have seen the closed StackOverflow post on this topic. I also tried echo '* libraries/restart-without-asking boolean true' | sudo debconf-set-selections
with no change in behavior.
Before running the script, /etc/needrestart/needrestart.conf had a line with this: $nrconf{restart} = 'i';
, and after running the script, the line changed to this: $nrconf{restart} = 'a';
. This did not change the popup behavior.