# Set destruction times or poweroff times for VMS

**URL:** <https://forum.opennebula.io/t/set-destruction-times-or-poweroff-times-for-vms/5139>\
**Category:** Integration Support\
**Created:** [October 21, 2017, 12:46pm UTC](https://forum.opennebula.io/t/set-destruction-times-or-poweroff-times-for-vms/5139 "2017-10-21T12:46:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfer-neb](https://avatars.discourse-cdn.com/v4/letter/j/d9b06d/32.png) [@jfer-neb](https://forum.opennebula.io/u/jfer-neb)\
**Post date:** [October 21, 2017, 12:46pm UTC](https://forum.opennebula.io/t/set-destruction-times-or-poweroff-times-for-vms/5139/1 "2017-10-21T12:46:53Z")

</div>

I’ve seen a few other commercial products where your can specify “I want this VM to run for X hours or days” and then either power off the vm or destroy the vm entirely.

It would also be beneficial to specify poweroff times for vm’s based on work hours. For example:  
“vm 99 is powered off between 1AM and 9AM, and automatically power’s back on at 9:01AM”  
This way, you save consumption usage when users do not power off vm’s.

All of these examples would be for the az\_driver / ec2\_driver and vcenter hosts.

---

<div class="post-metadata">

**Author:** ![ruben](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ruben/32/19_2.png) [@ruben](https://forum.opennebula.io/u/ruben)\
**Post date:** [November 12, 2017, 4:58pm UTC](https://forum.opennebula.io/t/set-destruction-times-or-poweroff-times-for-vms/5139/2 "2017-11-12T16:58:37Z")

</div>

You can program actions for the VMs. Your example would be like:

1. Poweroff VM at 1AM
2. Resume VM at 9AM

However, this actions cannot include any periodicity right now. So, they  
should be reprogram. (Note as a dirty hack this can be done through a hook,  
when the VM resumes. But this is a workaround till we develop recurrent  
actions)

[http://docs.opennebula.org/5.4/operation/vm\_management/vm\_instances.html?highlight=scheduled%20actions#scheduling-actions](http://docs.opennebula.org/5.4/operation/vm_management/vm_instances.html?highlight=scheduled%20actions#scheduling-actions)
