From 8f9b06609fb4fa313002630c359956c2e72a14d0 Mon Sep 17 00:00:00 2001 From: tteckster Date: Fri, 28 Apr 2023 08:17:20 -0400 Subject: [PATCH] Update monitor-lxcs.sh incorporate add/remove functions --- misc/monitor-lxcs.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/misc/monitor-lxcs.sh b/misc/monitor-lxcs.sh index 5648ba4d..7576114a 100644 --- a/misc/monitor-lxcs.sh +++ b/misc/monitor-lxcs.sh @@ -17,6 +17,7 @@ cat <<"EOF" EOF +add() { while true; do read -p "This script will add Monitor LXC to Proxmox VE. Proceed(y/n)?" yn case $yn in @@ -92,10 +93,22 @@ systemctl daemon-reload systemctl enable -q --now ping-containers.service clear echo -e "\n To view Monitor LXC logs: cat /var/log/ping-containers.log" +} -# To remove Monitor LXC from Proxmox VE -# 1) systemctl stop ping-containers.service -# 2) systemctl disable ping-containers.service -# 3) rm /etc/systemd/system/ping-containers.service -# 4) rm /usr/local/bin/ping-containers.sh -# 5) rm /var/log/ping-containers.log +remove() { + systemctl stop ping-containers.service + systemctl disable ping-containers.service &>/dev/null + rm /etc/systemd/system/ping-containers.service + rm /usr/local/bin/ping-containers.sh + rm /var/log/ping-containers.log + echo "Removed Monitor LXC from Proxmox VE" +} + +if [ "$1" == "add" ]; then + add +elif [ "$1" == "remove" ]; then + remove +else + echo "Usage: $0 [add | remove]" + exit 1 +fi