automated net commit


Hi guys, I'm have a cuestion..

I'm working with Cumulus Linux, I do changes on my cumulus, and write changes using net commit ...
I would like do a "net commit " and exactly after, copy modifyed files to my backup folder

for example:

Cumulus_base ---> I'm do changes ---> git commit --> if it was ok = "copy modified files to /mnt/backup/ "

I think that it is posible using a crontab job, but I'm prefer execute exactly after
or I need write a (bash/python) script to do it...

a) It is posible?
b) cumulus have a service to do this ?

2 replies

Userlevel 3
Hi Jtan, Cumulus Linux already uses snapper to create snapshots. And snapshots are automatically taken right before and after a net commit. I hope this helps!

https://docs.cumulusnetworks.com/display/DOCS/Using+Snapshots
Userlevel 4
There is no process which ships in Cumulus Linux today which allows you to automatically run a command after a successful net commit. It would be possible to write a syslog parser to do something like this looking for the associated syslog messages informing a successful commit.

 sudo tail -n 1 /var/log/netd.log
2017-09-12T14:31:30.131832+00:00 leaf01 netd: INFO: RXed: user cumulus, command '/usr/bin/net commit'
Something looking for the message above. This option would be a bit more dynamic than using cron.

Reply