postgres configured

This commit is contained in:
bogale 2026-09-26 16:42:02 +09:00
commit d2b59d97cb
5 changed files with 57 additions and 30 deletions

View file

@ -46,18 +46,22 @@
LogLevelMax = "notice";
};
script = ''
if [ ! -e /run/network.failures ] || \
${pkgs.iputils}/bin/ping -c 1 -W 3 1.1.1.1; then
if [ ! -e /run/network.failures ] || [ ! -e /run/network.limit ] || \
${pkgs.curl}/bin/curl --head --max-time 3 https://www.google.com; then
limit=3
failures=0
else
limit=$(cat /run/network.limit)
failures=$((1+$(cat /run/network.failures)))
echo "<5>failures = $failures"
fi
if [ $failures -ge 3 ]; then
if [ $failures -ge $limit ]; then
echo "<4>restarting NetworkManager"
systemctl restart NetworkManager.service
[ $limit -lt 60 ] && limit=$((4*$limit/3))
failures=0
fi
echo $limit > /run/network.limit
echo $failures > /run/network.failures
'';
};