Autosnapshot Crontab

ayozeve

Member
Oct 16, 2020
23
3
8
36
Hello, I have the cv4pve-autosnap application installed in a cluster of 3 servers in ceph and I understand its operation well. Although it is a third party utility I have a doubt regarding the cron tasks. If I create a cron task to execute the snapshot, it creates it perfectly, but ideally it would be executed on each machine in case one of them is down.

If I add the cron task in each one, they show me errors as it is running in the others at the same time. Is there a way to schedule the cron job to run on one of them and skip the others?

I have seen, for example, that in vzdump, it writes to the file /etc/pve/jobs.cfg... I don't know if there would be something similar.

Thank you very much
 
If the application you are using is not designed to be run on multiple machines and to be aware of it, so it only executes its task on one, then you have a few options:
a) reach out to developers and request feature enhancement
b) run your application on external host/vm that connects to either smart DNS, virtual floating IP or proxy
c) wrap your application in a script that creates a flag in centralized location (perhaps /etc/pve, but I am not sure how race proof it is.). You could write a flag to NFS and "flock" it, making logic in your wrapper that if the flag is locked - dont run.
d) ansible might have functionality that will assist you

there may be other solutions as well.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
As far as I know cv4pve-autosnap uses the PVE API and doesn't has to be run on the PVE host itself. Wouldn't a HA VM/LXC be an option running it with crontab? Then you always got only one guest running it and it doesn't matter on which node it runs.
 
As far as I know cv4pve-autosnap uses the PVE API and doesn't has to be run on the PVE host itself. Wouldn't a HA VM/LXC be an option running it with crontab? Then you always got only one guest running it and it doesn't matter on which node it runs.

You're right, if in fact I had created the api to connect without credentials... It was designed to be executed that way and I was complicating everything haha. I don't know if anyone implements it in another way but running it in a virtual machine that is inside the HA seems great to me.

Thank you both very much
 

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!