Ad Widget

Collapse

See actual changes in files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jmart
    Junior Member
    • Jun 2016
    • 8

    #1

    See actual changes in files

    does anyone see any issues with doing something like this:

    I wanted to see the actual changes in the files..

    So I created an item like the following:

    it checks the file against the backup of the file and if they are the same it "echo 0" ; if they are different then it does a sdiff on the two files ; It then outputs the original file to the backup location

    Code:
    system.run[cmp -s /etc/somefile /tmp/file.bak && echo 0 || sdiff /etc/somefile /tmp/file.bak; cat /etc/somefile >/tmp/file.bak]
    Then a trigger:

    Code:
    {Template Operation File Validations:system.run[cmp -s /etc/somefile /tmp/file.bak && echo 0 || sdiff /etc/somefile /tmp/file.bak; cat /etc/somefile >/tmp/file.bak].prev(0)}=0 & {Template Operation File Validations:system.run[cmp -s /etc/somefile /tmp/file.bak && echo 0 || sdiff /etc/somefile /tmp/file.bak; cat /etc/somefile >/tmp/file.bak].diff(0)}=1
    Anytime the file changes, I now receive the exact text of what changed in the file.
    Last edited by Jmart; 24-04-2017, 17:24.
Working...