mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-03 03:59:16 +01:00
Redirect STDERR to log
This commit is contained in:
parent
a8dc934443
commit
69c78676ad
@ -19,6 +19,10 @@ SRWL_OPTS="-tvv"
|
||||
# keep logs of the firewall (not recommended)
|
||||
INITLOG=/var/log/shorewall-lite-init.log
|
||||
|
||||
[ "$INITLOG" eq "/dev/null" && SHOREWALL_INIT_SCRIPT=1 || SHOREWALL_INIT_SCRIPT=0
|
||||
|
||||
export SHOREWALL_INIT_SCRIPT
|
||||
|
||||
test -x $SRWL || exit 0
|
||||
test -x $WAIT_FOR_IFUP || exit 0
|
||||
test -n $INITLOG || {
|
||||
|
@ -67,6 +67,8 @@ elif [ -f /etc/default/shorewall ] ; then
|
||||
. /etc/default/shorewall
|
||||
fi
|
||||
|
||||
SHOREWALL_INIT_SCRIPT=1
|
||||
|
||||
################################################################################
|
||||
# E X E C U T I O N B E G I N S H E R E #
|
||||
################################################################################
|
||||
|
@ -14,10 +14,13 @@ usage() {
|
||||
#
|
||||
# Start trace if first arg is "debug" or "trace"
|
||||
#
|
||||
tracing=
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
if [ "x$1" = "xtrace" ]; then
|
||||
set -x
|
||||
shift
|
||||
tracing=1
|
||||
elif [ "x$1" = "xdebug" ]; then
|
||||
DEBUG=Yes
|
||||
shift
|
||||
@ -26,6 +29,21 @@ fi
|
||||
|
||||
initialize
|
||||
|
||||
if [ -n "$STARTUP_LOG" ]; then
|
||||
if [ -a ${SHOREWALL_INIT_SCRIPT:-0} -eq 1 ]; then
|
||||
#
|
||||
# We're being run by a startup script that isn't redirecting STDOUT
|
||||
# Redirect it to the log
|
||||
#
|
||||
exec 2> $STARTUP_LOG
|
||||
elif [ -z "${SHOREWALL_INIT_SCRIPT}${DEBUG}${tracing}" ]; then
|
||||
#
|
||||
# We're not tracing or debugging -- tee STDOUT to the log
|
||||
#
|
||||
exec 2>| tee $STARTUP_LOG
|
||||
fi
|
||||
fi
|
||||
|
||||
finished=0
|
||||
|
||||
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
||||
|
@ -26,6 +26,21 @@ fi
|
||||
|
||||
initialize
|
||||
|
||||
if [ -n "$STARTUP_LOG" ]; then
|
||||
if [ -a ${SHOREWALL_INIT_SCRIPT:-0} -eq 1 ]; then
|
||||
#
|
||||
# We're being run by a startup script that isn't redirecting STDOUT
|
||||
# Redirect it to the log
|
||||
#
|
||||
exec 2> $STARTUP_LOG
|
||||
elif [ -z "${SHOREWALL_INIT_SCRIPT}${DEBUG}${tracing}" ]; then
|
||||
#
|
||||
# We're not tracing or debugging -- tee STDOUT to the log
|
||||
#
|
||||
exec 2>| tee $STARTUP_LOG
|
||||
fi
|
||||
fi
|
||||
|
||||
finished=0
|
||||
|
||||
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
||||
|
@ -15,9 +15,13 @@
|
||||
SRWL=/sbin/shorewall
|
||||
SRWL_OPTS=""
|
||||
WAIT_FOR_IFUP=/usr/share/shorewall/wait4ifup
|
||||
# Note, set INITLOG to /dev/null if you do not want to
|
||||
# keep logs of the firewall (not recommended)
|
||||
INITLOG=/dev/null
|
||||
# Note, set INITLOG to /dev/null if you want to
|
||||
# use Shorewall's STARTUP_LOG feature.
|
||||
INITLOG=/var/log/shorewall-init.log
|
||||
|
||||
[ "$INITLOG" eq "/dev/null" && SHOREWALL_INIT_SCRIPT=1 || SHOREWALL_INIT_SCRIPT=0
|
||||
|
||||
export SHOREWALL_INIT_SCRIPT
|
||||
|
||||
test -x $SRWL || exit 0
|
||||
test -x $WAIT_FOR_IFUP || exit 0
|
||||
|
@ -68,6 +68,8 @@ elif [ -f /etc/default/shorewall ] ; then
|
||||
. /etc/default/shorewall
|
||||
fi
|
||||
|
||||
export SHOREWALL_INIT_SCRIPT=1
|
||||
|
||||
################################################################################
|
||||
# E X E C U T I O N B E G I N S H E R E #
|
||||
################################################################################
|
||||
|
@ -243,9 +243,7 @@ if [ ! -f ${PREFIX}/etc/shorewall/shorewall.conf ]; then
|
||||
#
|
||||
# Make a Debian-like shorewall.conf
|
||||
#
|
||||
perl -p -w -i -e 's|^STARTUP_ENABLED=.*|STARTUP_ENABLED=Yes|;
|
||||
s|^STARTUP_LOG=.*|STARTUP_LOG=/var/lib/shorewall-init.log|;
|
||||
s|^LOG_VERBOSITY=.*|LOG_VERBOSITY=2|;' ${PREFIX}/etc/shorewall.conf
|
||||
perl -p -w -i -e 's|^STARTUP_ENABLED=.*|STARTUP_ENABLED=Yes|;' ${PREFIX}/etc/shorewall.conf
|
||||
fi
|
||||
|
||||
echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf"
|
||||
|
@ -19,6 +19,10 @@ SRWL_OPTS="-tvv"
|
||||
# keep logs of the firewall (not recommended)
|
||||
INITLOG=/var/log/shorewall6-lite-init.log
|
||||
|
||||
[ "$INITLOG" eq "/dev/null" && SHOREWALL_INIT_SCRIPT=1 || SHOREWALL_INIT_SCRIPT=0
|
||||
|
||||
export SHOREWALL_INIT_SCRIPT
|
||||
|
||||
test -x $SRWL || exit 0
|
||||
test -x $WAIT_FOR_IFUP || exit 0
|
||||
test -n $INITLOG || {
|
||||
|
@ -67,6 +67,8 @@ elif [ -f /etc/default/shorewall6-lite ] ; then
|
||||
. /etc/default/shorewall6-lite
|
||||
fi
|
||||
|
||||
export SHOREWALL_INIT_SCRIPT=1
|
||||
|
||||
################################################################################
|
||||
# E X E C U T I O N B E G I N S H E R E #
|
||||
################################################################################
|
||||
|
@ -19,6 +19,10 @@ WAIT_FOR_IFUP=/usr/share/shorewall6/wait4ifup
|
||||
# keep logs of the firewall (not recommended)
|
||||
INITLOG=/var/log/shorewall6-init.log
|
||||
|
||||
[ "$INITLOG" eq "/dev/null" && SHOREWALL_INIT_SCRIPT=1 || SHOREWALL_INIT_SCRIPT=0
|
||||
|
||||
export SHOREWALL_INIT_SCRIPT
|
||||
|
||||
test -x $SRWL || exit 0
|
||||
test -x $WAIT_FOR_IFUP || exit 0
|
||||
test -n $INITLOG || {
|
||||
|
@ -68,6 +68,8 @@ elif [ -f /etc/default/shorewall6 ] ; then
|
||||
. /etc/default/shorewall6
|
||||
fi
|
||||
|
||||
export SHOREWALL_INIT_SCRIPT=1
|
||||
|
||||
################################################################################
|
||||
# E X E C U T I O N B E G I N S H E R E #
|
||||
################################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user