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)
|
# keep logs of the firewall (not recommended)
|
||||||
INITLOG=/var/log/shorewall-lite-init.log
|
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 $SRWL || exit 0
|
||||||
test -x $WAIT_FOR_IFUP || exit 0
|
test -x $WAIT_FOR_IFUP || exit 0
|
||||||
test -n $INITLOG || {
|
test -n $INITLOG || {
|
||||||
|
@ -67,6 +67,8 @@ elif [ -f /etc/default/shorewall ] ; then
|
|||||||
. /etc/default/shorewall
|
. /etc/default/shorewall
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SHOREWALL_INIT_SCRIPT=1
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# E X E C U T I O N B E G I N S H E R E #
|
# 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"
|
# Start trace if first arg is "debug" or "trace"
|
||||||
#
|
#
|
||||||
|
tracing=
|
||||||
|
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
if [ "x$1" = "xtrace" ]; then
|
if [ "x$1" = "xtrace" ]; then
|
||||||
set -x
|
set -x
|
||||||
shift
|
shift
|
||||||
|
tracing=1
|
||||||
elif [ "x$1" = "xdebug" ]; then
|
elif [ "x$1" = "xdebug" ]; then
|
||||||
DEBUG=Yes
|
DEBUG=Yes
|
||||||
shift
|
shift
|
||||||
@ -26,6 +29,21 @@ fi
|
|||||||
|
|
||||||
initialize
|
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
|
finished=0
|
||||||
|
|
||||||
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
||||||
|
@ -26,6 +26,21 @@ fi
|
|||||||
|
|
||||||
initialize
|
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
|
finished=0
|
||||||
|
|
||||||
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
||||||
|
@ -15,9 +15,13 @@
|
|||||||
SRWL=/sbin/shorewall
|
SRWL=/sbin/shorewall
|
||||||
SRWL_OPTS=""
|
SRWL_OPTS=""
|
||||||
WAIT_FOR_IFUP=/usr/share/shorewall/wait4ifup
|
WAIT_FOR_IFUP=/usr/share/shorewall/wait4ifup
|
||||||
# Note, set INITLOG to /dev/null if you do not want to
|
# Note, set INITLOG to /dev/null if you want to
|
||||||
# keep logs of the firewall (not recommended)
|
# use Shorewall's STARTUP_LOG feature.
|
||||||
INITLOG=/dev/null
|
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 $SRWL || exit 0
|
||||||
test -x $WAIT_FOR_IFUP || exit 0
|
test -x $WAIT_FOR_IFUP || exit 0
|
||||||
|
@ -68,6 +68,8 @@ elif [ -f /etc/default/shorewall ] ; then
|
|||||||
. /etc/default/shorewall
|
. /etc/default/shorewall
|
||||||
fi
|
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 #
|
# 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
|
# Make a Debian-like shorewall.conf
|
||||||
#
|
#
|
||||||
perl -p -w -i -e 's|^STARTUP_ENABLED=.*|STARTUP_ENABLED=Yes|;
|
perl -p -w -i -e 's|^STARTUP_ENABLED=.*|STARTUP_ENABLED=Yes|;' ${PREFIX}/etc/shorewall.conf
|
||||||
s|^STARTUP_LOG=.*|STARTUP_LOG=/var/lib/shorewall-init.log|;
|
|
||||||
s|^LOG_VERBOSITY=.*|LOG_VERBOSITY=2|;' ${PREFIX}/etc/shorewall.conf
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf"
|
echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf"
|
||||||
|
@ -19,6 +19,10 @@ SRWL_OPTS="-tvv"
|
|||||||
# keep logs of the firewall (not recommended)
|
# keep logs of the firewall (not recommended)
|
||||||
INITLOG=/var/log/shorewall6-lite-init.log
|
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 $SRWL || exit 0
|
||||||
test -x $WAIT_FOR_IFUP || exit 0
|
test -x $WAIT_FOR_IFUP || exit 0
|
||||||
test -n $INITLOG || {
|
test -n $INITLOG || {
|
||||||
|
@ -67,6 +67,8 @@ elif [ -f /etc/default/shorewall6-lite ] ; then
|
|||||||
. /etc/default/shorewall6-lite
|
. /etc/default/shorewall6-lite
|
||||||
fi
|
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 #
|
# 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)
|
# keep logs of the firewall (not recommended)
|
||||||
INITLOG=/var/log/shorewall6-init.log
|
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 $SRWL || exit 0
|
||||||
test -x $WAIT_FOR_IFUP || exit 0
|
test -x $WAIT_FOR_IFUP || exit 0
|
||||||
test -n $INITLOG || {
|
test -n $INITLOG || {
|
||||||
|
@ -68,6 +68,8 @@ elif [ -f /etc/default/shorewall6 ] ; then
|
|||||||
. /etc/default/shorewall6
|
. /etc/default/shorewall6
|
||||||
fi
|
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 #
|
# 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