]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/initscripts/init.d/networking/red
Included lm_sensors and the needed HW-Monitoring Modules
[ipfire-2.x.git] / src / initscripts / init.d / networking / red
index 7be289b00d0d63008323702219a4e9f3ce1e8a10..9bc848228ae5ada2597b41425f134f3a144e5ca9 100644 (file)
@@ -88,6 +88,9 @@ case "${1}" in
                                exit 1
                        fi
                fi
+
+               ## Create & Enable vnstat
+               /usr/bin/vnstat -u -i ${DEVICE} -r --enable --force > /dev/null 2>&1
                
                if [ "${TYPE}" == "STATIC" ]; then
                
@@ -99,6 +102,9 @@ case "${1}" in
                        echo -n "${DEVICE}" > /var/ipfire/red/iface
                        echo -n "${ADDRESS}"  > /var/ipfire/red/local-ipaddress
                        echo -n "${GATEWAY}" > /var/ipfire/red/remote-ipaddress
+                       grep -v "gateway" /etc/hosts > /tmp/hosts
+                       echo "$GATEWAY gateway"  >> /tmp/hosts
+                       mv /tmp/hosts /etc/hosts
                        echo -n "${DNS1}" > /var/ipfire/red/dns1
                        echo -n "${DNS2}" > /var/ipfire/red/dns2
                        touch /var/ipfire/red/active
@@ -159,6 +165,9 @@ case "${1}" in
 
                                . /var/ipfire/dhcpc/dhcpcd-${DEVICE}.info
                                echo "$IPADDR"  > /var/ipfire/red/local-ipaddress
+                               grep -v "gateway" /etc/hosts > /tmp/hosts
+                               echo "$GATEWAY gateway"  >> /tmp/hosts
+                               mv /tmp/hosts /etc/hosts
                                echo "$GATEWAY" > /var/ipfire/red/remote-ipaddress
                        else
                                echo ""
@@ -312,7 +321,8 @@ case "${1}" in
                                evaluate_retval
                                # echo PPP: /usr/sbin/pppd pty "$PPPOE_CMD" $PPP_STD_OPTIONS $DEBUG $DEMAND $PPPD_SYNC
                        fi
-                       
+                       ## Create & Enable vnstat
+                       /usr/bin/vnstat -u -i ppp0 -r --enable --force > /dev/null 2>&1
                        /etc/rc.d/init.d/connectd start
 
                fi
@@ -366,6 +376,8 @@ case "${1}" in
                
                elif [ "$TYPE" == "PPPOE" ]; then
                        boot_mesg "Bringing down the PPP interface ..."
+                       ## Disable vnstat collection
+                       /usr/bin/vnstat -u -i ppp0 -r --disable > /dev/null 2>&1
                        rm -f /var/ipfire/red/keepconnected
                        killall -w -s TERM /usr/sbin/pppd 2>/dev/null
                        evaluate_retval
@@ -385,8 +397,11 @@ case "${1}" in
                killall -w -s KILL /usr/sbin/pppd >/dev/null 2>&1
                killall -w -s KILL br2684ctl >/dev/null 2>&1
                rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
+
+               ## Disable vnstat collection
+               /usr/bin/vnstat -u -i ${DEVICE} -r --disable > /dev/null 2>&1
+               exit 0;
                ;;
-               
 esac
 
 # End