serv
This commit is contained in:
parent
adcb608988
commit
cc24363fc3
2 changed files with 11 additions and 9 deletions
|
|
@ -40,9 +40,12 @@
|
||||||
};
|
};
|
||||||
defaults.email = "letsencrypt@bogaledev.ru";
|
defaults.email = "letsencrypt@bogaledev.ru";
|
||||||
};
|
};
|
||||||
services.openssh = {
|
services = {
|
||||||
enable = true;
|
logind.settings.Login.HandleLidSwitch = "ignore";
|
||||||
settings.PasswordAuthentication = false;
|
openssh = {
|
||||||
|
enable = true;
|
||||||
|
settings.PasswordAuthentication = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
sops = {
|
sops = {
|
||||||
secrets = {
|
secrets = {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
services = {
|
services = {
|
||||||
network-watchdog = {
|
network-watchdog = {
|
||||||
script = ''
|
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 ] || \
|
if [ ! -e /run/network.failures ] || [ ! -e /run/network.limit ] || \
|
||||||
${pkgs.curl}/bin/curl --head --max-time 3 https://bogaledev.ru; then
|
${pkgs.curl}/bin/curl --head --max-time 3 https://bogaledev.ru; then
|
||||||
limit=3
|
limit=3
|
||||||
|
|
@ -29,9 +31,9 @@
|
||||||
failures=$((1+$(cat /run/network.failures)))
|
failures=$((1+$(cat /run/network.failures)))
|
||||||
fi
|
fi
|
||||||
if [ $failures -ge $limit ]; then
|
if [ $failures -ge $limit ]; then
|
||||||
echo "<4>restarting network"
|
echo "<4>Restarting network"
|
||||||
systemctl restart NetworkManager.service
|
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
|
systemctl restart wg-quick-awg0.service
|
||||||
[ $limit -lt 360 ] && limit=$((2*$limit))
|
[ $limit -lt 360 ] && limit=$((2*$limit))
|
||||||
failures=0
|
failures=0
|
||||||
|
|
@ -39,10 +41,7 @@
|
||||||
echo $limit > /run/network.limit
|
echo $limit > /run/network.limit
|
||||||
echo $failures > /run/network.failures
|
echo $failures > /run/network.failures
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig.Type = "oneshot";
|
||||||
LogLevelMax = "warning";
|
|
||||||
Type = "oneshot";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
tgbot-send = {
|
tgbot-send = {
|
||||||
script = ''
|
script = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue