Files
homelab/update_vms.sh
2023-05-24 02:42:40 -05:00

23 lines
423 B
Bash

#!/bin/sh
ALPINE='portainer seedbox caddy pihole'
UBUNTU='pbs proxmox'
msg() {
>&2 printf '[*] %s\n' "$*"
}
for i in $ALPINE ; do
if ping -q -W 2 -c 1 "$i" >/dev/null ; then
msg "Updating: $i"
ssh "$i" 'apk update;apk upgrade'
fi
done
for i in $UBUNTU ; do
if ping -q -W 2 -c 1 "$i" >/dev/null ; then
msg "Updating: $i"
ssh "$i" 'apt update;apt upgrade -y;apt dist-upgrade -y;apt autoremove -y'
fi
done