This commit is contained in:
bogale 2026-10-29 00:38:34 +09:00
commit cc24363fc3
2 changed files with 11 additions and 9 deletions

View file

@ -20,6 +20,8 @@
services = {
network-watchdog = {
script = ''
exec {lock_fd}> /run/network.lock
${pkgs.util-linux}/bin/flock -n $lock_fd || exit
if [ ! -e /run/network.failures ] || [ ! -e /run/network.limit ] || \
${pkgs.curl}/bin/curl --head --max-time 3 https://bogaledev.ru; then
limit=3
@ -29,9 +31,9 @@
failures=$((1+$(cat /run/network.failures)))
fi
if [ $failures -ge $limit ]; then
echo "<4>restarting network"
echo "<4>Restarting network"
systemctl restart NetworkManager.service
sleep 1
until ${pkgs.iputils}/bin/ping 10.1.0.1 -c 1 -W 1; do sleep 1; done
systemctl restart wg-quick-awg0.service
[ $limit -lt 360 ] && limit=$((2*$limit))
failures=0
@ -39,10 +41,7 @@
echo $limit > /run/network.limit
echo $failures > /run/network.failures
'';
serviceConfig = {
LogLevelMax = "warning";
Type = "oneshot";
};
serviceConfig.Type = "oneshot";
};
tgbot-send = {
script = ''