Bash script that detects changed and new files
- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| CLAUDE.md | ||
| LICENSE | ||
| README.md | ||
jnewfiles
Bash script for Linux servers that detects changed and new files.
Installation instructions:
- Clone or download this repository.
- Install the jnewfiles script from the src folder in the folder /usr/local/sbin in your server.
- Make the script executable:
chmod +x /usr/local/sbin/jnewfiles. - Optional: put the per-server settings (patterns to search for and to ignore) in
/etc/jnewfiles.conf. Start fromsrc/jnewfiles.confand install it owned by root and not writable by others:
install -o root -g root -m 644 src/jnewfiles.conf /etc/jnewfiles.conf
Without this file the built-in defaults from the script are used. Another file can be given with-c <file>. After editing, check it withbash -n /etc/jnewfiles.conf. - Optional but recommended: rotate the log file
/var/log/jnewfiles.log, which also keeps the full list of every reported file:
install -o root -g root -m 644 src/jnewfiles.logrotate /etc/logrotate.d/jnewfiles - Add a cronjob for user root to run the script every hour (replace you@yourdomain.com with your personal emailaddress):
20 * * * * /usr/local/sbin/jnewfiles -n you@yourdomain.com >/dev/null 2>&1
Or setnotify_emails="you@yourdomain.com"in/etc/jnewfiles.confand leave out-n:
20 * * * * /usr/local/sbin/jnewfiles >/dev/null 2>&1 - You can run the script on the commandline to see the options:
jnewfiles -h.