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"
 | 
			
		||||
IFSTATE="$RUN_DIR/ifstate"
 | 
			
		||||
 | 
			
		||||
NAME=networking
 | 
			
		||||
SCRIPTNAME=/etc/init.d/$NAME
 | 
			
		||||
 | 
			
		||||
[ -x /sbin/ifup ] || exit 0
 | 
			
		||||
[ -x /sbin/ifdown ] || exit 0
 | 
			
		||||
 | 
			
		||||
@@ -20,6 +23,7 @@ IFSTATE="$RUN_DIR/ifstate"
 | 
			
		||||
 | 
			
		||||
CONFIGURE_INTERFACES=yes
 | 
			
		||||
EXCLUDE_INTERFACES=
 | 
			
		||||
REMOTE_SYSLOG_SERVER=
 | 
			
		||||
VERBOSE=no
 | 
			
		||||
 | 
			
		||||
verbose=
 | 
			
		||||
@@ -47,11 +51,20 @@ gen_examples() {
 | 
			
		||||
    return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
is_bootup() {
 | 
			
		||||
    # Return 0 if its bootup or return 1
 | 
			
		||||
    [ -f /var/tmp/network/ifstatenew ] && return 1
 | 
			
		||||
 | 
			
		||||
    return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
perf_options() {
 | 
			
		||||
    # At bootup lets set perfmode
 | 
			
		||||
    [ -f /var/tmp/network/ifstatenew ] && echo -n "" && return
 | 
			
		||||
 | 
			
		||||
    echo -n "--perfmode"
 | 
			
		||||
    if is_bootup ; then
 | 
			
		||||
       echo -n "--perfmode"
 | 
			
		||||
    else
 | 
			
		||||
       echo -n ""
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
process_exclusions() {
 | 
			
		||||
@@ -139,12 +152,13 @@ start)
 | 
			
		||||
	exclusions=$(process_exclusions)
 | 
			
		||||
	perfoptions=$(perf_options)
 | 
			
		||||
	log_action_begin_msg "Configuring network interfaces"
 | 
			
		||||
	if ifup -a $verbose $perfoptions
 | 
			
		||||
	then
 | 
			
		||||
	    log_action_end_msg $?
 | 
			
		||||
	if is_bootup ; then
 | 
			
		||||
	    ifup -a $verbose $perfoptions 2>&1 | /usr/bin/logger \
 | 
			
		||||
			$REMOTE_SYSLOG_SERVER -s -i -t $SCRIPTNAME
 | 
			
		||||
	else
 | 
			
		||||
	    log_action_end_msg $?
 | 
			
		||||
	    ifup -a $verbose $perfoptions
 | 
			
		||||
	fi
 | 
			
		||||
	log_action_end_msg $?
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
stop)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user