I’m wondering if vyos has commit hooks.
As an example, i’d like to expand on commit archiving a bit.
currently the config-management commit-archive setting doesn’t let me choose what to back up. I would like to be able to automatically back up the /config directory on every commit and scp that to a backup server. As it stands things like vpn keys aren’t included in your commit-archive
For now i can run an rsync task via cron to get backups and there are other similar ways to do it, but such things are done on a schedule, not when changes are commited.
I’m curious, how do others handle this?
/config/scripts/commit/post-hooks.d - folder with scripts that run after each commit
i don’t have a commit directory under /config/scripts. I assume if i create the location you mentioned the scripts will be called?
Correct. Pay attention to the script names - only letters, numbers, underscores, and minus characters are allowed there.
[custom]-script-01.sh - wrong name because of
. inside the name
01-custom-script - good name
And do not forget to make it executable (
Also, these scripts will be run without root privileges. Use
sudo inside if this is necessary.
Could you share your post-commit archive scripts, as that sounds very useful?