ШПАРГАЛКИ
CI/CD
KUBERNETES
- LINUX
- GIT
- DOCKER
- DOCKERFILE
- DOCKER-COMPOSE
- DOCKERSWARM
- KUBERNETES
- ANSIBLE
- BASH
- DOCKERFILE
- DOCKER-COMPOSE
- JENKINSFILE
- JENKINS-PIPELINE
- GITLAB CI/CD
- GROOVIE
- INSTALL
- PODS
- INGRESS
Перезагрузка виртуалок Proxmox через bash скрипт
а то забуду
#!/bin/bash
clear
if ! [ -x "$(command -v jq)" ]; then
echo 'Error: jq is not installed.' >&2
echo "apt-get install jq"
exit 1
fi
if [ -z $1 ]; then
echo "Use "$0" VMID"
exit 1
fi
VMID=$1
NODE=`pvesh get /cluster/resources --type vm | jq --raw-output ".[] | select(.vmid == ${VMID}) | .node"`
# shutdown VM
pvesh create /nodes/${NODE}/qemu/${VMID}/status/shutdown
# get status
while true
do
STATUS=`pvesh get /nodes/${NODE}/qemu/${VMID}/status/current | jq --raw-output ".status"`
echo "NODE="${NODE}" VMID="${VMID}" is "${STATUS}
sleep 5
if [ "${STATUS}" == "stopped" ]; then
break
fi
done
# start
sleep 5
pvesh create /nodes/${NODE}/qemu/${VMID}/status/start
date
exit 0