Skip to content

Instantly share code, notes, and snippets.

@neilgee
Last active May 5, 2025 07:23
Show Gist options
  • Save neilgee/2bb861ad1396bf7d358230fd47b66a8b to your computer and use it in GitHub Desktop.
Save neilgee/2bb861ad1396bf7d358230fd47b66a8b to your computer and use it in GitHub Desktop.
Maldet Alternate Cron
#!/bin/bash
# Paths to scan
SCAN_PATHS=(
"/home/?/webapps/?"
)
# Days of modification to scan
SCAN_DAYS=1
# Log file location
LOG_FILE="/var/log/maldet-custom.log"
# Timestamp
echo "===== $(date '+%Y-%m-%d %H:%M:%S') =====" >> "$LOG_FILE"
# Run maldet scan for each path (foreground for manual testing)
for path in "${SCAN_PATHS[@]}"; do
echo "Scanning: $path" >> "$LOG_FILE"
/usr/local/maldetect/maldet -r "$path" "$SCAN_DAYS" --report >> "$LOG_FILE" 2>&1
done
echo "" >> "$LOG_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment