I'm trying to use Incron on Centos 7 to watch a directory for changes and back those changes up into a local git repo.
As a test, I've created the following:
/root/srv <-- The live source directory
/root/git <-- The backup location directory
/root/bin/git-autocommit <-- The script that does the backup and move
My git-autocommit script looks like this: #!/bin/bash
REP_DIR="/root/git" # repository directory
NOTIFY_DIR="/root/srv" # directory to version
cd $REP_DIR
GIT_WORK_TREE=$NOTIFY_DIR /usr/bin/git add .
GIT_WORK_TREE=$NOTIFY_DIR /usr/bin/git commit -a -m "auto"
And I've made it executable.
I'm now trying to execute:
incrontab -e /root/srv IN_MODIFY,IN_CREATE,IN_MOVED_FROM,IN_MOVED_TO /root/bin/git-autocommit
but I keep getting this error:
invalid arguments - operation and source file cannot be combined
I can't exactly figure out what's going on.
it is probably too late for this answer, but adding a monitor is done in two steps
will open a file and in it you will add and save the command