Browse Source

disable lxd-containers-restart-on-failure.service

main
pvincent 3 months ago
parent
commit
d0ee0fc86f
  1. 44
      lib/install.sh

44
lib/install.sh

@ -43,28 +43,28 @@ function prepare_lxd {
sudo /opt/miaou-bash/tools/idem_apt_install lxd btrfs-progs
sudo tee /etc/systemd/system/lxd-containers-restart-on-failure.service &>/dev/null <<EOF
[Unit]
Description=restart lxd containers when no dhclient
After=lxd.service lxd-containers.service
Requires=lxd.socket
StartLimitInterval=60
StartLimitBurst=5
[Service]
Type=exec
ExecCondition=sh -c '[ \$(lxc list status=running -c4 -fcsv | wc -l) -gt 0 ]] && lxc list status=running -c4 -fcsv | grep -vq eth0'
ExecStart=systemctl restart lxd-containers.service
ExecStartPost=sh -c 'sleep 2 ; [ \$(lxc list status=running -c4 -fcsv | wc -l) -eq 0 ]] || lxc list status=running -c4 -fcsv | grep -q eth0'
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
# sudo tee /etc/systemd/system/lxd-containers-restart-on-failure.service &>/dev/null <<EOF
# [Unit]
# Description=restart lxd containers when no dhclient
# After=lxd.service lxd-containers.service
# Requires=lxd.socket
# StartLimitInterval=60
# StartLimitBurst=5
# [Service]
# Type=exec
# ExecCondition=sh -c '[ \$(lxc list status=running -c4 -fcsv | wc -l) -gt 0 ]] && lxc list status=running -c4 -fcsv | grep -vq eth0'
# ExecStart=systemctl restart lxd-containers.service
# ExecStartPost=sh -c 'sleep 2 ; [ \$(lxc list status=running -c4 -fcsv | wc -l) -eq 0 ]] || lxc list status=running -c4 -fcsv | grep -q eth0'
# Restart=on-failure
# RestartSec=10
# [Install]
# WantedBy=multi-user.target
# EOF
# sudo systemctl daemon-reload
}
function configure_lxd {

Loading…
Cancel
Save