@@ -0,0 +1,47 @@
+#!/bin/bash
+SCRIPTNAME=$0
+
+function get_logserver {
+ DHCPINFOFILE=`grep -H ^LOGSERVER /var/lib/dhcpcd/*.info |awk -F: '{print $1}'`
+ if [ -f "${DHCPINFOFILE}" ] ; then
+ . ${DHCPINFOFILE}
+ export LOGSERVER
+ echo ${LOGSERVER}
+ else
+ echo "localhost"
+ fi
+}
+
+function add_logserver {
+ LOGHOST=`get_logserver`
+ case ${LOGHOST} in
+ localhost)
+ :
+ ;;
+ *)
+ if [ -f /etc/syslog-ng/syslog-ng.conf ] ; then
+ if [ -z "`grep ${LOGHOST} /etc/syslog-ng/syslog-ng.conf`" ] ; then
+ echo "
+destination loghost {
+ udp(\"${LOGHOST}\" port (514));
+};
+log { source(src); destination(loghost); };
+" >> /etc/syslog-ng/syslog-ng.conf
+ if [ -x /etc/init.d/syslog ] ; then
+ /etc/init.d/syslog restart
+ fi
+ fi
+ fi
+ ;;
+ esac
+}
+
+
+case $SCRIPTNAME in
+*if-up.d*)
+ add_logserver
+;;
+*if-down.d*)
+ :
+;;
+esac
|