Compare commits

..

No commits in common. "d51a8df90f611e9e2aff52cc090f93c946fe39cc" and "2ca3e77bea73561c70c088fa731cf7435c0e0963" have entirely different histories.

5 changed files with 29 additions and 32 deletions

View File

@ -2,14 +2,6 @@
# Change Log
All notable changes to this project will be documented in this file.
## 2023-04-30
### Changed
- **Proxmox VE Monitor-All**
- NEW Script
- Replaces Proxmox VE LXC Monitor
## 2023-04-28
### Changed

View File

@ -375,9 +375,6 @@ install_script() {
ssh_check
arch_check
pve_check
if systemctl is-active -q ping-instances.service; then
systemctl stop ping-instances.service
fi
NEXTID=$(pvesh get /cluster/nextid)
timezone=$(cat /etc/timezone)
header_info
@ -511,7 +508,4 @@ description() {
pct set "$CTID" -description "# ${APP} LXC
### https://tteck.github.io/Proxmox/
<a href='https://ko-fi.com/D1D7EP4GF'><img src='https://img.shields.io/badge/☕-Buy me a coffee-red' /></a>"
if [[ -f /etc/systemd/system/ping-instances.service ]]; then
systemctl start ping-instances.service
fi
}

View File

@ -6,8 +6,8 @@
# https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info() {
clear
cat <<"EOF"
clear
cat <<"EOF"
________ __ _ ________
/ ____/ /__ ____ _____ / / | |/ / ____/
/ / / / _ \/ __ `/ __ \ / / | / /
@ -34,6 +34,7 @@ while true; do
esac
done
clear
containers=$(pct list | tail -n +2 | cut -f1 -d' ')
function clean_container() {
container=$1
header_info
@ -42,7 +43,7 @@ function clean_container() {
pct exec $container -- bash -c "apt-get -y --purge autoremove && apt-get -y autoclean && bash <(curl -fsSL https://github.com/tteck/Proxmox/raw/main/misc/clean.sh) && rm -rf /var/lib/apt/lists/* && apt-get update"
}
for container in $(pct list | awk '{if(NR>1) print $1}'); do
for container in $containers; do
os=$(pct config "$container" | awk '/^ostype/ {print $2}')
if [ "$os" != "debian" ] && [ "$os" != "ubuntu" ]; then
header_info
@ -52,16 +53,16 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
fi
status=$(pct status $container)
template=$(pct config $container | grep -q "template:" && echo "true" || echo "false")
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n"
pct start $container
echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL} \n"
sleep 5
clean_container $container
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
pct shutdown $container &
elif [ "$status" == "status: running" ]; then
clean_container $container
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n"
pct start $container
echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL} \n"
sleep 5
clean_container $container
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
pct shutdown $container &
elif [ "$status" == "status: running" ]; then
clean_container $container
fi
done
wait

View File

@ -4,6 +4,8 @@
# Author: tteck (tteckster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
# Proxmox VE LXC Monitor All
# bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/monitor-all.sh)" -s add
clear
cat <<"EOF"
@ -30,9 +32,17 @@ echo '#!/usr/bin/env bash
excluded_instances=("$@")
echo "Excluded instances: ${excluded_instances[@]}"
while true; do
while true
do
# Get the list of containers and virtual machines
containers=$(pct list | tail -n +2 | cut -f1 -d" ")
virtual_machines=$(qm list | grep -oP "^\s*\K\d+(?=\s)")
for instance in $(pct list | awk '\''{if(NR>1) print $1}'\''; qm list | awk '\''{if(NR>1) print $1}'\''); do
# Combine the container and virtual machine lists
all_instances="$containers $virtual_machines"
for instance in $all_instances
do
# Skip excluded instances
if [[ " ${excluded_instances[@]} " =~ " ${instance} " ]]; then
continue
@ -86,7 +96,7 @@ done >> /var/log/ping-instances.log 2>&1' >/usr/local/bin/ping-instances.sh
# Change file permissions to executable
chmod +x /usr/local/bin/ping-instances.sh
# Create ping-instances.service
# Create ping-containers.service
echo '[Unit]
Description=Ping instances every 5 minutes and restarts if necessary
@ -102,7 +112,7 @@ StandardError=file:/var/log/ping-instances.log
[Install]
WantedBy=multi-user.target' >/etc/systemd/system/ping-instances.service
# Reload daemon, enable and start ping-instances.service
# Reload daemon, enable and start ping-containers.service
systemctl daemon-reload
systemctl enable -q --now ping-instances.service
clear

View File

@ -49,7 +49,7 @@ function update_container() {
esac
}
header_info
for container in $(pct list | awk '{if(NR>1) print $1}'); do
for container in $(pct list | tail -n +2 | cut -f1 -d' '); do
excluded=false
for excluded_container in "${excluded_containers[@]}"; do
if [ "$container" == "$excluded_container" ]; then