2022-02-13 08:43:52 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -xeuo pipefail
|
|
|
|
|
2022-02-14 06:54:44 +00:00
|
|
|
pacman -Syu --noconfirm --noprogressbar
|
2022-02-13 08:43:52 +00:00
|
|
|
|
|
|
|
% for affected, restarts in sorted(restart_triggers.items()):
|
2022-02-14 06:54:44 +00:00
|
|
|
up_since=$(systemctl show "${affected}" | sed -n 's/^ActiveEnterTimestamp=//p' || echo 0)
|
|
|
|
up_since_ts=$(date -d "$up_since" +%s || echo 0)
|
|
|
|
now=$(date +%s)
|
2022-02-13 08:43:52 +00:00
|
|
|
|
2022-02-14 06:54:44 +00:00
|
|
|
if [ $((now - up_since_ts)) -lt 3600 ]
|
|
|
|
then
|
2022-02-13 08:43:52 +00:00
|
|
|
% for restart in sorted(restarts):
|
2022-02-14 06:54:44 +00:00
|
|
|
systemctl restart "${restart}" || true
|
2022-02-13 08:43:52 +00:00
|
|
|
% endfor
|
2022-02-14 06:54:44 +00:00
|
|
|
fi
|
2022-02-13 08:43:52 +00:00
|
|
|
% endfor
|