Ubuntu22.04でWhich service should be restarted?を聞かれないようにする(自動化)
code:shell
sudo vim /etc/needrestart/needrestart.conf
or
新しいファイル
sudo vim /etc/needrestart/conf.d/00-my-needrestart.conf
前者の場合
code:/etc/needrestart/needrestart.conf
# Restart mode: (l)ist only, (i)nteractive or (a)utomatically.
#
# ATTENTION: If needrestart is configured to run in interactive mode but is run
# non-interactive (i.e. unattended-upgrades) it will fallback to list only mode.
#
$nrconf{restart} = 'a'; # <- コメントインして、'i'→'a'
後者の場合
code:/etc/needrestart/conf.d/00-my-needrestart.conf
$nrconf{restart} = 'a';
参考
needrestartで学ぶパッケージのフック処理
【2022年版】 Ubuntu 22.04 で apt install すると、Which services should be restarted? ときかれる