Tuesday, October 9, 2012

# bash script # housekeep nmon report

Script to remove old nmon logs

I was having tons of nmon reports piling up on my servers so I decided to do a little Bash script to housekeep them on my Linux distros. Works on SLES and RHEL

#!/bin/bash
NMON_DIR="/var/nmon_reports/24hour"
OLD_NMON_DIR="/var/nmon_reports/old_logs"
cd ${NMON_DIR}
find . -name "*.nmon" -mtime +1 -exec gzip -9 {} \;
mv ${NMON_DIR}/*.gz ${OLD_NMON_DIR}

No comments:

Post a Comment