[SOLVED] Cluster wide cron job possible?

Jan 16, 2022
195
8
23
38
hi currently we use :

/etc/crontab

to configure a cron on each host , and the file is in /etc/pve/cron/cronxyz.cron

is there a way to have PVE cluster service runnning this job and not individual host ?
 
Last edited:
What do you mean by that? A random node in cluster gets to run it, while others should be aware and not run it? Each node should run it?
Are you looking for cron "redundancy" , ie the job should continue running elsewhere if node fails?

You may find this interesting: https://serverfault.com/questions/865741/high-availability-cron-jobs


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
yes that is correct

let say for example :

*/5 * * * * root qm status 104 | grep -q stopped || qm start 104

i dont want to put this job on each node if possible. as the VM may move to another host over time.
 
i dont want to put this job on each node if possible. as the VM may move to another host over time.
The solution to that is not to use "qm", you should use pvesh/API and direct you request to nginx that front-ends/routes to available node.
The script will be slightly more complex:
get cluster resources
get vm info/status/node
send request to cluster/node/qemu/vm to start


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
The solution to that is not to use "qm", you should use pvesh/API and direct you request to nginx that front-ends/routes to available node.
The script will be slightly more complex:
get cluster resources
get vm info/status/node
send request to cluster/node/qemu/vm to start


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
and of course this API call need to be executed extrenaly right ?

will do some learning curve then !
 
You can run the call from anywhere, including any node in the cluster. The API will find the right node to execute on, but you are still not protected from the calling node/server/vm being down. So if you have a management/admin workstation that is responsible for centralized management, that might be best choice.
A lot of options and variables to take into consideration as always.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 

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!