Created
December 10, 2012 15:18
-
-
Save mricon/4251184 to your computer and use it in GitHub Desktop.
Using syslog with snaplock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SNAPLOCK="/mnt/snaplock" | |
for ZONE in internal dmz frontend; do | |
YESTERDAY=`date +'%Y/%m/%d' -d 'yesterday'` | |
TOMORROW=`date +'%Y/%m/%d' -d 'tomorrow'` | |
LOCKTILL=`date +'%Y%m%d0000' -d '+5 years'` | |
if [ -d "${SNAPLOCK}/${ZONE}/${YESTERDAY}" ]; then | |
chmod 0444 ${SNAPLOCK}/${ZONE}/${YESTERDAY}/* | |
fi | |
mkdir -p ${SNAPLOCK}/${ZONE}/${TOMORROW} | |
for FILE in audit secure; do | |
touch -a -t ${LOCKTILL} ${SNAPLOCK}/${ZONE}/${TOMORROW}/${FILE}.log.gz | |
chmod 0444 ${SNAPLOCK}/${ZONE}/${TOMORROW}/${FILE}.log.gz | |
chmod 0644 ${SNAPLOCK}/${ZONE}/${TOMORROW}/${FILE}.log.gz | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment