schedule restart single Vm

Maurizio

Active Member
Feb 23, 2017
13
1
43
52
Hi
it's possible schedule a shutdown to a single VM?
I try with a bash script in crontab but doesn't work.

startvm() {
/usr/sbin/qm start $VM_ID
}
stopvm() {
/usr/sbin/qm stop $VM_ID
}
shutdownvm() {
/usr/sbin/qm shutdown $VM_ID
}
case "$1" in
start) startvm ;;
stop) stopvm ;;
shutdown) shutdownvm ;;
restart) stopvm; startvm ;;
*) echo "usage: $0 start|stop|shutdown|restart vm-id" >&2
exit 1
;;
esac

thanks in advance
Maurizio
 
[SOLVED] add bash execution in cron
bash -x /path/scriptname.sh start/shutdown VM-ID >/dev/null 2>&1
 
  • Like
Reactions: mediacj

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!