summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2012-03-12 10:55:05 +0000
committerErmal <eri@pfsense.org>2012-03-12 10:55:26 +0000
commit973b2663e42e27e0a98c09cdee9c7e978266f709 (patch)
tree30c6996a0b44fafda4c090c2934a99ba8c1faf2d
parent06fd1952d38746404570c3577e79ad5fa34fe372 (diff)
downloadpfsense-973b2663e42e27e0a98c09cdee9c7e978266f709.zip
pfsense-973b2663e42e27e0a98c09cdee9c7e978266f709.tar.gz
Simplify this code a little and make it easily extendible.
-rwxr-xr-xetc/rc104
1 files changed, 15 insertions, 89 deletions
diff --git a/etc/rc b/etc/rc
index c09b155..c9fc16e 100755
--- a/etc/rc
+++ b/etc/rc
@@ -257,97 +257,23 @@ fi
echo -n "."
DISABLESYSLOGCLOG=`cat /cf/conf/config.xml | grep disablesyslogclog | wc -l | awk '{ print $1 }'`
-if [ "$DISABLESYSLOGCLOG" -gt "0" ]; then
- /usr/bin/touch /var/log/system.log
- /usr/bin/touch /var/log/filter.log
- /usr/bin/touch /var/log/dhcpd.log
- /usr/bin/touch /var/log/vpn.log
- /usr/bin/touch /var/log/pptps.log
- /usr/bin/touch /var/log/poes.log
- /usr/bin/touch /var/log/l2tps.log
- /usr/bin/touch /var/log/openvpn.log
- /usr/bin/touch /var/log/portalauth.log
- /usr/bin/touch /var/log/ipsec.log
- /usr/bin/touch /var/log/ppp.log
- /usr/bin/touch /var/log/relayd.log
- /usr/bin/touch /var/log/wireless.log
- /usr/bin/touch /var/log/lighttpd.log
- /usr/bin/touch /var/log/ntpd.log
- /usr/bin/touch /var/log/apinger.log
-else
- ENABLEFIFOLOG=`cat /cf/conf/config.xml | grep usefifolog | wc -l | awk '{ print $1 }'`
- if [ "$ENABLEFIFOLOG" -gt "0" ]; then
- # generate fifolog files
- /usr/sbin/fifolog_create -s 511488 /var/log/system.log
- /usr/sbin/fifolog_create -s 511488 /var/log/filter.log
- /usr/sbin/fifolog_create -s 50688 /var/log/dhcpd.log
- /usr/sbin/fifolog_create -s 50688 /var/log/vpn.log
- /usr/sbin/fifolog_create -s 50688 /var/log/pptps.log
- /usr/sbin/fifolog_create -s 50688 /var/log/poes.log
- /usr/sbin/fifolog_create -s 50688 /var/log/l2tps.log
- /usr/sbin/fifolog_create -s 50688 /var/log/openvpn.log
- /usr/sbin/fifolog_create -s 50688 /var/log/portalauth.log
- /usr/sbin/fifolog_create -s 50688 /var/log/ipsec.log
- /usr/sbin/fifolog_create -s 50688 /var/log/ppp.log
- /usr/sbin/fifolog_create -s 50688 /var/log/relayd.log
- /usr/sbin/fifolog_create -s 50688 /var/log/wireless.log
- /usr/sbin/fifolog_create -s 50688 /var/log/lighttpd.log
- /usr/sbin/fifolog_create -s 50688 /var/log/ntpd.log
- /usr/sbin/fifolog_create -s 50688 /var/log/apinger.log
+ENABLEFIFOLOG=`cat /cf/conf/config.xml | grep usefifolog | wc -l | awk '{ print $1 }'`
+LOG_FILES="system filter dhcpd vpn pptps poes l2tps openvpn portalauth ipsec ppp relayd wireless lighttpd ntpd apinger"
+for logfile in $LOG_FILES; do
+ if [ "$DISABLESYSLOGCLOG" -gt "0" ]; then
+ /usr/bin/touch /var/log/$logfile.log
else
- if [ ! -f /var/log/system.log ]; then
- /usr/sbin/clog -i -s 512144 /var/log/system.log
+ if [ ! -f /var/log/$logfile.log ]; then
+ if [ "$ENABLEFIFOLOG" -gt "0" ]; then
+ # generate fifolog files
+ /usr/sbin/fifolog_create -s 511488 /var/log/$logfile.log
+ else
+ /usr/sbin/clog -i -s 512144 /var/log/$logfile.log
+ fi
fi
- if [ ! -f /var/log/filter.log ]; then
- /usr/sbin/clog -i -s 512144 /var/log/filter.log
- fi
- if [ ! -f /var/log/dhcpd.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/dhcpd.log
- fi
- if [ ! -f /var/log/vpn.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/vpn.log
- fi
- if [ ! -f /var/log/pptps.log ]; then
- /usr/sbin/clog -i -s 50688 /var/log/pptps.log
- fi
- if [ ! -f /var/log/poes.log ]; then
- /usr/sbin/clog -i -s 50688 /var/log/poes.log
- fi
- if [ ! -f /var/log/l2tps.log ]; then
- /usr/sbin/clog -i -s 50688 /var/log/l2tps.log
- fi
- if [ ! -f /var/log/openvpn.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/openvpn.log
- fi
- if [ ! -f /var/log/portalauth.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/portalauth.log
- fi
- if [ ! -f /var/log/ipsec.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/ipsec.log
- fi
- if [ ! -f /var/log/ppp.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/ppp.log
- fi
- if [ ! -f /var/log/slbd.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/slbd.log
- fi
- if [ ! -f /var/log/lighttpd.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/lighttpd.log
- fi
- if [ ! -f /var/log/ntpd.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/ntpd.log
- fi
- if [ ! -f /var/log/relayd.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/relayd.log
- fi
- if [ ! -f /var/log/wireless.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/wireless.log
- fi
- if [ ! -f /var/log/apinger.log ]; then
- /usr/sbin/clog -i -s 65535 /var/log/apinger.log
- fi
- fi
-fi
+ fi
+done
+
# change permissions on newly created fifolog files.
/bin/chmod 0600 /var/log/*.log
OpenPOWER on IntegriCloud