I have a monit service running.
It checks to see if a file changed, then it fires off a script to make sure that file gets put into git:
check file ncc_db with path /home/ootbdv/ncc_db/production.sqlite3
if changed checksum then exec "/home/ootbdv/ncc_db/autocommit.sh"
I know that I've setup monit correctly because the log file shows this.
[PDT Jun 3 01:04:14] info : 'ncc_db' checksum has not changed
[PDT Jun 3 01:10:14] error : 'ncc_db' checksum was changed for /home/ootbdv/ncc_db/production.sqlite3
[PDT Jun 3 01:10:14] info : 'ncc_db' exec: /home/ootbdv/ncc_db/autocommit.sh
[PDT Jun 3 01:12:14] error : 'ncc_db' checksum was changed for /home/ootbdv/ncc_db/production.sqlite3
[PDT Jun 3 01:12:14] info : 'ncc_db' exec: /home/ootbdv/ncc_db/autocommit.sh
[PDT Jun 3 01:14:14] info : 'ncc_db' checksum has not changed
So I know that monit is working.
I also know the script is working because, as root, when I type in /home/ootbdv/ncc_db/autocommit.sh
the script works as expected, it jumps into the directory and fires off the git command.
The script:
#/bin/bash
cd /home/ootbdv/ncc_db/
git commit -a -m 'monit:autocommit'
Am I doing something wrong such that monit isn't working as expected?