. /etc/sysconfig/rc
. ${rc_functions}
+
+eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
+if [ "$RRDLOG" == "" ]; then
+ RRDLOG=/var/log/rrd
+fi
+
eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
TYPE="${RED_TYPE}"
case "${1}" in
start)
- # Stop collectd if running
- if [ "$(ps -A | grep " collectd$")" != "" ]; then
- /etc/rc.d/init.d/collectd stop
- fi
if [ "${DEVICE}" != "${GREEN_DEV}" ] && [ "${DEVICE}" != "" ]; then
boot_mesg "Bringing up the ${DEVICE} interface..."
boot_mesg_flush
else
boot_mesg "Interface ${DEVICE} doesn't exist." ${FAILURE}
echo_failure
- /etc/rc.d/init.d/collectd start
exit 1
fi
fi
evaluate_retval
run_subdir ${rc_base}/init.d/networking/red.up/
-
+
+ # Configure aliases only if red static
+ /usr/local/bin/setaliases
+
elif [ "${TYPE}" == "DHCP" ]; then
+
+ if [ -e $LEASEINFO ]; then
+ boot_mesg -n "Stopping dhcpcd on the ${DEVICE} interface..."
+ . $LEASEINFO
+ if [ "$LEASETIME" = "4294967295" ]; then
+ # do nothing, just echo ok
+ echo ""
+ echo_ok
+ else
+ if [ -n "$DHCP_STOP" ]; then
+ /sbin/dhcpcd ${DEVICE} $DHCP_STOP &> /dev/null
+ RET="$?"
+ if [ "$RET" -eq 0 ]; then
+ echo ""
+ echo_ok
+ elif [ "$RET" -eq 1 ]; then
+ boot_mesg "dhcpcd not running!" ${WARNING}
+ echo_warning
+ else
+ echo ""
+ echo_failure
+ fi
+ else
+ echo ""
+ killproc dhcpcd
+ fi
+ fi
+ fi
+
boot_mesg -n "Starting dhcpcd on the ${DEVICE} interface..."
echo -n "${DEVICE}" > /var/ipfire/red/iface
else
boot_mesg "dhcpcd already running!" ${WARNING}
echo_warning
- /etc/rc.d/init.d/collectd start
exit 2
fi
fi
echo "$GATEWAY gateway" >> /tmp/hosts
mv /tmp/hosts /etc/hosts
echo "$GATEWAY" > /var/ipfire/red/remote-ipaddress
+ touch /var/ipfire/red/active
else
echo ""
$(exit "$RET")
if ( ps ax | grep -q [p]ppd ); then
boot_mesg "pppd is still running." ${FAILURE}
echo_failure
- /etc/init.d/collectd start
exit 1
fi
if [ "$PPP_NIC" == "" ]; then
boot_mesg "No device for red interface given. Check netsetup or dialprofile!" ${FAILURE}
echo_failure
- /etc/rc.d/init.d/collectd start
exit 0
fi
boot_mesg "Bringing up the $TYPE interface on $PPP_NIC ..."
## Create & Enable vnstat
/usr/bin/vnstat -u -i ppp0 -r --enable --force > /dev/null 2>&1
/etc/rc.d/init.d/connectd start
- /etc/rc.d/init.d/collectd start
+ # Add a NaN value to ppp0 rrd to supress spikes at reconnect
+ rrdtool update $RRDLOG/collectd/localhost/interface/if_octets-ppp0.rrd \
+ $(date +%s):: > /dev/null 2>&1
+ exit 0
fi
;;
rm -f /var/ipfire/red/keepconnected
killall -w -s TERM /usr/sbin/pppd 2>/dev/null
evaluate_retval
+ # Add a NaN value to ppp0 rrd to supress spikes at reconnect
+ rrdtool update $RRDLOG/collectd/localhost/interface/if_octets-ppp0.rrd \
+ $(date +%s):: > /dev/null 2>&1
fi
if [ "$DEVICE" != "${GREEN_DEV}" ] && [ "$DEVICE" != "" ]; then