mirror of https://github.com/tteck/Proxmox.git
Compare commits
No commits in common. "85b0003df959634982e26dc2986343b29165ce37" and "359d5a3a48048ee7d8b0b9b51cd0033ca17e03d6" have entirely different histories.
85b0003df9
...
359d5a3a48
|
@ -88,55 +88,43 @@ while true; do
|
||||||
# Wait for 5 minutes. (Edit to your needs)
|
# Wait for 5 minutes. (Edit to your needs)
|
||||||
echo "$(date): Pausing for 5 minutes..."
|
echo "$(date): Pausing for 5 minutes..."
|
||||||
sleep 300
|
sleep 300
|
||||||
done >/var/log/ping-instances.log 2>&1' >/usr/local/bin/ping-instances.sh
|
done >> /var/log/ping-instances.log 2>&1' >/usr/local/bin/ping-instances.sh
|
||||||
touch /var/log/ping-instances.log
|
|
||||||
# Change file permissions to executable
|
# Change file permissions to executable
|
||||||
chmod +x /usr/local/bin/ping-instances.sh
|
chmod +x /usr/local/bin/ping-instances.sh
|
||||||
cat <<EOF >/etc/systemd/system/ping-instances.timer
|
|
||||||
[Unit]
|
|
||||||
Description=Delay ping-instances.service by 5 minutes
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnBootSec=300
|
|
||||||
OnUnitActiveSec=300
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create ping-instances.service
|
# Create ping-instances.service
|
||||||
cat <<EOF >/etc/systemd/system/ping-instances.service
|
echo '[Unit]
|
||||||
[Unit]
|
|
||||||
Description=Ping instances every 5 minutes and restarts if necessary
|
Description=Ping instances every 5 minutes and restarts if necessary
|
||||||
After=ping-instances.timer
|
|
||||||
Requires=ping-instances.timer
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
# To specify which CT/VM should be excluded, add the CT/VM ID at the end of the line where ExecStart=/usr/local/bin/ping-instances.sh is specified.
|
# To specify which CT/VM should be excluded, add the CT/VM ID at the end of the line where ExecStart=/usr/local/bin/ping-instances.sh is specified.
|
||||||
# For example: ExecStart=/usr/local/bin/ping-instances.sh 100 102
|
# For example: ExecStart=/usr/local/bin/ping-instances.sh 100 102
|
||||||
# Virtual machines without the QEMU guest agent installed must be excluded.
|
# Virtual machines without the QEMU guest agent installed must be excluded.
|
||||||
|
# Sleep for 300 seconds (5 minutes)
|
||||||
|
ExecStartPre=/usr/bin/sleep 300
|
||||||
ExecStart=/usr/local/bin/ping-instances.sh
|
ExecStart=/usr/local/bin/ping-instances.sh
|
||||||
Restart=always
|
Restart=always
|
||||||
StandardOutput=file:/var/log/ping-instances.log
|
StandardOutput=file:/var/log/ping-instances.log
|
||||||
StandardError=file:/var/log/ping-instances.log
|
StandardError=file:/var/log/ping-instances.log
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target' >/etc/systemd/system/ping-instances.service
|
||||||
EOF
|
|
||||||
|
|
||||||
# Reload daemon, enable and start ping-instances.service
|
# Reload daemon, enable and start ping-instances.service
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable -q --now ping-instances.timer
|
|
||||||
systemctl enable -q --now ping-instances.service
|
systemctl enable -q --now ping-instances.service
|
||||||
clear
|
clear
|
||||||
echo -e "\n To view Monitor All logs: cat /var/log/ping-instances.log"
|
echo -e "\n To view Monitor All logs: cat /var/log/ping-instances.log"
|
||||||
}
|
}
|
||||||
|
|
||||||
remove() {
|
remove() {
|
||||||
systemctl disable -q --now ping-instances.timer
|
systemctl stop ping-instances.service
|
||||||
systemctl disable -q --now ping-instances.service
|
systemctl disable ping-instances.service &>/dev/null
|
||||||
rm /etc/systemd/system/ping-instances.service /etc/systemd/system/ping-instances.timer /usr/local/bin/ping-instances.sh /var/log/ping-instances.log
|
rm /etc/systemd/system/ping-instances.service
|
||||||
|
rm /usr/local/bin/ping-instances.sh
|
||||||
|
rm /var/log/ping-instances.log
|
||||||
echo "Removed Monitor All from Proxmox VE"
|
echo "Removed Monitor All from Proxmox VE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue