apprell / proxmox-autosnap Goto Github PK
View Code? Open in Web Editor NEWAutomatic ZFS Snapshot Script for Proxmox VE 5, 6, 7 and 8
Automatic ZFS Snapshot Script for Proxmox VE 5, 6, 7 and 8
Hello @apprell ,
I'm curious if I can modify this to allow for a snapshot in minutes instead of hourly being the shortest time frame to take a snapshot. I was hoping to take a snapshot on one particular VM every 5 minutes or 10 minutes. is this is possible what would I need to change please in order to achieve this?
Thank you in advance for any advice you can provide me.
I did proxmox-autosnap.py --snap --vmid all --label hourly
I would now like to stop all hourly autosnap from occurring.
What is the command I need to run to do so?
I got the following error while testing autosnap on my LXC containers.
Traceback (most recent call last):
File "/root/proxmox-autosnap/proxmox-autosnap.py", line 119, in <module>
remove_snapsot(vmid=k, virtualization=v, label=argp.label, keep=argp.keep, mute=argp.mute)
File "/root/proxmox-autosnap/proxmox-autosnap.py", line 25, in create_pid
return func(*args, **kwargs)
File "/root/proxmox-autosnap/proxmox-autosnap.py", line 68, in remove_snapsot
snapshots = run_command([virtualization, 'listsnapshot', vmid])
File "/root/proxmox-autosnap/proxmox-autosnap.py", line 35, in run_command
return {'status': True, 'message': out.decode('utf-8').rstrip()}
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 45: invalid continuation byte
It's due to the fact that one of my containers has already a snap with accentuated characters in the comment.
Once the accentuated character removed, the process runs smoothly
Hello, I need to create my snapshoots in date-iso-format so that other system that I use can handle the snapshoots and the replications (I'm only able to manage in this format), when I run "/usr/local/sbin/proxmox-autosnap.py --autosnap --vmid all --label hourly --keep 23 --mute --date-iso-format" in my sheel my snapshoots are with the correct format (autohourly_2023_04_20T11_33_58) but when the same command in run on cron, my naming is "autohourly230420100514", as if date-iso-format is ignored.
This is my crontab:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
######## Auto Snapshoot
# Task for snapshot every hour from 1 through 23.
5 1-23 * * * root /usr/local/sbin/proxmox-autosnap.py --autosnap --vmid all --label hourly --keep 23 --mute --date-iso-format
# Task for snapshot every day-of-month from 2 through 31.
5 0 2-31 * * root /usr/local/sbin/proxmox-autosnap.py --autosnap --vmid all --label daily --keep 30 --mute --date-iso-format
# Task for snapshot at 00:05 on day-of-month 1.
5 0 1 * * root /usr/local/sbin/proxmox-autosnap.py --autosnap --vmid all --label monthly --keep 3 --mute --date-iso-format
Thank you
If an instance is running and a second instance starts, it correctly finds the 1st instance's pid file and exits but the finally deletes the pid file. When the 1st instance completes and tries to clean up the pid, it throws exceptions as the file was deleted by the 2nd instance.
Traceback (most recent call last):
File "/usr/local/sbin/proxmox-autosnap.py", line 171, in <module>
main()
File "/usr/local/sbin/proxmox-autosnap.py", line 27, in create_pid
os.unlink(location_pid)
FileNotFoundError: [Errno 2] No such file or directory: '/root/proxmox-autosnap/running.pid'
Hello, I love this script, tks for sharing! But it would be nice to add the ability to send the replication. Is that possible?
Thank you
Hello @apprell ,
I really appreciate you providing this script for all to use! I think this is critical within Proxmox.
I'd like to add the function to send me an email when the auto_snap has successfully completed...or perhaps even better if auto_snap failed to complete for some reason. How would I do this? Do I add it to my cron job? Are there parms I need to use to verify the success of the auto_snap completing?
Also, is there a setting within auto_snap to include RAM when the snapshot is taken?
Thanks in advance for any advice you can provide me.
We are getting this error,
Script already running under PID xxxxxx , skipping execution
the number is always the same and the snapshots never happen.
using it on Proxmox 7.3-3
I cannot find the PID with ps -aux | grep xxxxxx
When I try to set --date-iso-format I get a error:
proxmox-autosnap.py: error: unrecognized arguments: --date-iso-format
Is this supported?
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.