mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
log /etc/init.d/networking errors into syslog using /usr/bin/logger
Ticket: CM-3193 Reviewed By: Testing Done: Tested logging of errors in syslog from ifup at bootup Example error msg: "Jul 10 03:13:17 cumulus /etc/init.d/networking[1183]: error: /etc/network/interfaces: line16: invalid auto line 'auto'" This patch logs into syslog only during bootup
This commit is contained in:
@@ -13,6 +13,9 @@ PATH="/sbin:/bin"
|
|||||||
RUN_DIR="/run/network"
|
RUN_DIR="/run/network"
|
||||||
IFSTATE="$RUN_DIR/ifstate"
|
IFSTATE="$RUN_DIR/ifstate"
|
||||||
|
|
||||||
|
NAME=networking
|
||||||
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
|
||||||
[ -x /sbin/ifup ] || exit 0
|
[ -x /sbin/ifup ] || exit 0
|
||||||
[ -x /sbin/ifdown ] || exit 0
|
[ -x /sbin/ifdown ] || exit 0
|
||||||
|
|
||||||
@@ -20,6 +23,7 @@ IFSTATE="$RUN_DIR/ifstate"
|
|||||||
|
|
||||||
CONFIGURE_INTERFACES=yes
|
CONFIGURE_INTERFACES=yes
|
||||||
EXCLUDE_INTERFACES=
|
EXCLUDE_INTERFACES=
|
||||||
|
REMOTE_SYSLOG_SERVER=
|
||||||
VERBOSE=no
|
VERBOSE=no
|
||||||
|
|
||||||
verbose=
|
verbose=
|
||||||
@@ -47,11 +51,20 @@ gen_examples() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_bootup() {
|
||||||
|
# Return 0 if its bootup or return 1
|
||||||
|
[ -f /var/tmp/network/ifstatenew ] && return 1
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
perf_options() {
|
perf_options() {
|
||||||
# At bootup lets set perfmode
|
# At bootup lets set perfmode
|
||||||
[ -f /var/tmp/network/ifstatenew ] && echo -n "" && return
|
if is_bootup ; then
|
||||||
|
echo -n "--perfmode"
|
||||||
echo -n "--perfmode"
|
else
|
||||||
|
echo -n ""
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
process_exclusions() {
|
process_exclusions() {
|
||||||
@@ -139,12 +152,13 @@ start)
|
|||||||
exclusions=$(process_exclusions)
|
exclusions=$(process_exclusions)
|
||||||
perfoptions=$(perf_options)
|
perfoptions=$(perf_options)
|
||||||
log_action_begin_msg "Configuring network interfaces"
|
log_action_begin_msg "Configuring network interfaces"
|
||||||
if ifup -a $verbose $perfoptions
|
if is_bootup ; then
|
||||||
then
|
ifup -a $verbose $perfoptions 2>&1 | /usr/bin/logger \
|
||||||
log_action_end_msg $?
|
$REMOTE_SYSLOG_SERVER -s -i -t $SCRIPTNAME
|
||||||
else
|
else
|
||||||
log_action_end_msg $?
|
ifup -a $verbose $perfoptions
|
||||||
fi
|
fi
|
||||||
|
log_action_end_msg $?
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
|
Reference in New Issue
Block a user