Bash script that detects changed and new files
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-04 08:40:35 +01:00
src Rnamed jnewfiles to jnewfiles.sh 2026-11-04 08:40:35 +01:00
CLAUDE.md Added notify_emails to config 2026-11-04 08:32:07 +01:00
LICENSE Initial commit 2026-06-10 11:03:54 +00:00
README.md Added notify_emails to config 2026-11-04 08:32:07 +01:00

jnewfiles

Bash script for Linux servers that detects changed and new files.

Installation instructions:

  1. Clone or download this repository.
  2. Install the jnewfiles script from the src folder in the folder /usr/local/sbin in your server.
  3. Make the script executable: chmod +x /usr/local/sbin/jnewfiles.
  4. Optional: put the per-server settings (patterns to search for and to ignore) in /etc/jnewfiles.conf. Start from src/jnewfiles.conf and 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 with bash -n /etc/jnewfiles.conf.
  5. 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
  6. 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 set notify_emails="you@yourdomain.com" in /etc/jnewfiles.conf and leave out -n:
    20 * * * * /usr/local/sbin/jnewfiles >/dev/null 2>&1
  7. You can run the script on the commandline to see the options: jnewfiles -h.