How to create a scheduled task in Prism | Nutanix Community
Skip to main content
Solved

How to create a scheduled task in Prism


Forum|alt.badge.img
  • Adventurer
  • 3 replies

Anyone know if it is possible to create a scheduled task in AHV to migrate a VM to another hosts in an AHV Cluster?

Best answer by Sergei Ivanov

If you don’t put any target host, it will randomly select the target from the available hosts, like this:
 

acli vm.migrate <vm_name>

Regarding the cron job, it is enough to put it on one of the CVMs and it will execute the command on the time that you specify. Do not make it on every CVM. 

BTW, if you do an AOS upgrade, all non-default cron jobs will disappear.

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

3 replies

Sergei Ivanov
Nutanix Employee
Forum|alt.badge.img+5
  • Nutanix Employee
  • 108 replies
  • July 7, 2020

Hi GeoB,

from Prism it cannot be done, but if you log in to a CVM via SSH as user ‘nutanix’ you can create a crontab line to run the command to migrate your VM at your desired time:

acli vm.migrate <vm_name> host=<target_host_name>

 


Forum|alt.badge.img
  • Author
  • Adventurer
  • 3 replies
  • July 7, 2020

Thanks for the help.  Is it possible to randomly select the target hosts, and can this cron job run from one hosts, and then be executed on all hosts in the cluster?

 

Thanks,

GeoB


Sergei Ivanov
Nutanix Employee
Forum|alt.badge.img+5
  • Nutanix Employee
  • 108 replies
  • Answer
  • July 7, 2020

If you don’t put any target host, it will randomly select the target from the available hosts, like this:
 

acli vm.migrate <vm_name>

Regarding the cron job, it is enough to put it on one of the CVMs and it will execute the command on the time that you specify. Do not make it on every CVM. 

BTW, if you do an AOS upgrade, all non-default cron jobs will disappear.