Skip to content

Instantly share code, notes, and snippets.

@tskrynnyk
Created March 16, 2011 00:52
Show Gist options
  • Select an option

  • Save tskrynnyk/871822 to your computer and use it in GitHub Desktop.

Select an option

Save tskrynnyk/871822 to your computer and use it in GitHub Desktop.
configs2asciidoc
#! /bin/sh
# configs2asciidoc::
#
INC_DIR=.
LIMITER='----'
write_config() {
DST=$1
shift 1
for i in $@; do
for j in `find $i -type f -not -name '*.db' -and -not -name '*.swp'`; do
{
echo '====' `basename $j`
echo
echo ".'$j':"
echo $LIMITER
#cat $j
sed -e 's/\(password\s*=\s*\)\([^ $]\+\)/\1\[hidden\]/ig' $j # hide potentially sensitive data
echo $LIMITER
echo
} >>$DST
done
done
}
rm ${INC_DIR}/*.txt
# lwatch
write_config ${INC_DIR}/lwatch.txt /etc/lwatch
# logwatch
write_config ${INC_DIR}/logwatch.txt /etc/logwatch/conf/logwatch.conf
# logrotate
write_config ${INC_DIR}/logrotate.txt /etc/logrotate.conf /etc/logrotate.d/ulogd
# postfix
write_config ${INC_DIR}/postfix.txt /etc/postfix
# amavis
write_config ${INC_DIR}/amavis.txt /etc/amavis/conf.d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment