# /usr/bin/env php /var/www/filemod.php --help
// set cache file path (must be writable, or if file does not exist must be in writable directory)
const CACHE_FILE_PATH = '/var/www/cache/filemod.cache.php';
# /usr/bin/env php /var/www/filemod.php /var/www/file1.php /var/www/file2.phpIn this example we register files /var/www/file1.php and /var/www/file2.php as watched files. If either of these file's data or modified date changes filemod will trigger an alert.
# /usr/bin/env php /var/www/filemod.php --list
Registered files to watch:
// email sender email address
const EMAIL_FROM = 'email@example.com';
// email subject
const EMAIL_SUBJECT = 'Protected file(s) have been modified (detected by filemod)';
// email address(es) to email when file modified (separate multiple addresses with semicolons)
// leave empty '' for no email send on file detected as modified
const EMAIL_TO = '';
# /usr/bin/env php /var/www/filemod.phpOr, for example, if file /var/www/file1.php was modified after we registered the file with filemod we would see something like:
No files have been modified
# /usr/bin/env php /var/www/filemod.phpWe can see that a protected file has been modified.
Protected file(s) have been modified:
"/var/www/file1.php" file contents have been modified (checksum: 42472cf2a3d01643c1a90865185072c9 => 093c696fd1eb6b52a549d8a3603c72f5)
"/var/www/file1.php" file has been modified (timestamp: 08/14/2013 19:53:17 => 08/14/2013 20:25:34)
"/var/www/file1.php" file details: owner: "someuser", group: "somegroup", permissions: "0744"
EDITOR=nano crontab -eThis will allow you to edit the crontab and add these lines to the crontab and save it:
# filemod.php script to watch protected filesNow the /var/www/filemod.php script should be executed every 10 minutes.
# run every 10 mintues
*/10 * * * * /usr/bin/env php /var/www/filemod.php