Mini Shell
Direktori : /etc/cron.daily/ |
|
Current File : //etc/cron.daily/ossec_logs_cleaner |
#!/usr/bin/bash
# -delete option implicitly uses -depth, which traverse folders with DFS
# (beginning with folder's content, ending with folder itself)
# so, if old folder contains old files, "directory is not empty" error won't happen.
# Old folder may not be deleted only if contains recently modified files
find -H /var/ossec/logs/{alerts/*,archives/*,firewall/*} -mtime +2 -not -name alerts.json -delete >/dev/null 2>&1
exit 0
Zerion Mini Shell 1.0