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