Git iwatch
Zur Navigation springen
Zur Suche springen
xml
<?xml version="1.0" ?> <!DOCTYPE config SYSTEM "/etc/iwatch/iwatch.dtd" > <config charset="utf-8"> <guard email="" name="IWatch"/> <watchlist> <title>etc watch</title> <contactpoint email="" name="Administrator"/> <path type="recursive" syslog="on" alert="off" exec="/usr/local/sbin/dir-watch.py %e %f">/etc</path> <path type="exception">/etc/apt</path> <path type="exception">/etc/.git</path> </watchlist> </config>
python script
#!/usr/bin/python import sys import os import re os.chdir("/etc") action = sys.argv[1] path = sys.argv[2] datei = os.path.basename(path) if action == "IN_CLOSE_WRITE": if re.search("^[^.0-9].*$",datei): os.system("/usr/bin/git add --all >> /tmp/iwatch 2>&1") os.system("/usr/bin/git commit -a -m " + datei + " >> /tmp/iwatch 2>&1") os.system("/usr/bin/git push -f >> /tmp/iwatch 2>&1")