? fix.patch Index: files/syslog-ng.confd =================================================================== RCS file: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.confd,v retrieving revision 1.1 diff -u -b -B -r1.1 syslog-ng.confd --- files/syslog-ng.confd 2 Nov 2006 20:51:37 -0000 1.1 +++ files/syslog-ng.confd 16 Dec 2012 23:52:58 -0000 @@ -1,5 +1,31 @@ # Config file for /etc/init.d/syslog-ng +# If you are not using network logging, this entire section should be +# commented out. Otherwise, choose one of the settings below based on +# how you are configuring your network. +# +# If you are using the net.* scripts to configure your network, you should +# set rc_need to match the interface through which your logging server +# can be reached. +#rc_need="net.eth0" +# +# If you are using an interface manager like wicd, dhcpcd in standalone +# mode, networkmanager, etc to control your interfaces, set rc_need to +# the name of that service. +# rc_need="dhcpcd" +#rc_need="networkmanager" +# +# If you are using newnet and configuring your interface statically with +# the network script, you should use this setting. +#rc_need="network" +# +# You can use this setting, but I do not recommend relying on it. +#rc_need="net" +# +# You may also want to uncomment the following if you are using network +# logging. +#rc_use="stunnel" + # Put any additional options for syslog-ng here. # See syslog-ng(8) for more information. Index: files/syslog-ng.rc6.3.3 =================================================================== RCS file: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.rc6.3.3,v retrieving revision 1.2 diff -u -b -B -r1.2 syslog-ng.rc6.3.3 --- files/syslog-ng.rc6.3.3 19 Oct 2011 06:19:38 -0000 1.2 +++ files/syslog-ng.rc6.3.3 16 Dec 2012 23:52:58 -0000 @@ -3,29 +3,19 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.rc6.3.3,v 1.2 2011/10/19 06:19:38 mr_bones_ Exp $ +command="syslog-ng" +command_args="${SYSLOG_NG_OPTS}" extra_commands="checkconfig" extra_started_commands="reload" +pidfile="${SYSLOG_NG_PIDFILE:-/var/run/${RC_SVCNAME}.pid}" description_checkconfig="Check the configuration file that will be used by \"start\"" description_reload="Reload the configuration without exiting" -SYSLOG_NG_SERVICE=${SVCNAME#*.} -SYSLOG_NG_SERVICE=${SYSLOG_NG_SERVICE:-syslog-ng} - -SYSLOG_NG_CONFIGFILE=${SYSLOG_NG_CONFIGFILE:-/etc/syslog-ng/${SYSLOG_NG_SERVICE}.conf} -SYSLOG_NG_PIDFILE=${SYSLOG_NG_PIDFILE:-/var/run/${SVCNAME}.pid} -SYSLOG_NG_OPTS="--cfgfile ${SYSLOG_NG_CONFIGFILE} --pidfile ${SYSLOG_NG_PIDFILE} ${SYSLOG_NG_OPTS}" +SYSLOG_NG_CONFIGFILE=${SYSLOG_NG_CONFIGFILE:-/etc/syslog-ng/${RC_SVCNAME}.conf} +command_args="--cfgfile ${SYSLOG_NG_CONFIGFILE} --pidfile ${pidfile} ${command_args}" depend() { - # Make networking dependency conditional on configuration - if [ -f "${SYSLOG_NG_CONFIGFILE}" ]; then - case `sed 's/#.*//' "${SYSLOG_NG_CONFIGFILE}"` in - *source*tcp*|*source*udp*|*destination*tcp*|*destination*udp*) - need net - use stunnel ;; - esac - fi - config "${SYSLOG_NG_CONFIGFILE}" use clock need hostname localmount @@ -36,38 +26,25 @@ if [ ! -e "${SYSLOG_NG_CONFIGFILE}" ] ; then eerror "You need to create ${SYSLOG_NG_CONFIGFILE} first." eerror "An example can be found in /usr/share/doc/syslog" - return 1 fi + ebegin "Checking your configfile (${SYSLOG_NG_CONFIGFILE})" syslog-ng -s -f "${SYSLOG_NG_CONFIGFILE}" - - # the start and reload functions have their own eends so - # avoid calling this twice when there are no problems - [ $? -eq 0 ] || eend $? "Configuration error. Please fix your configfile (${SYSLOG_NG_CONFIGFILE})" + eend $? "Configuration error. Please fix your configfile (${SYSLOG_NG_CONFIGFILE})" } -start() { +start_pre() { checkconfig || return 1 - ebegin "Starting ${SVCNAME}" - [ -n "${SYSLOG_NG_OPTS}" ] && SYSLOG_NG_OPTS="-- ${SYSLOG_NG_OPTS}" - start-stop-daemon --start --pidfile "${SYSLOG_NG_PIDFILE}" --exec /usr/sbin/syslog-ng ${SYSLOG_NG_OPTS} - eend $? "Failed to start ${SVCNAME}" } -stop() { - ebegin "Stopping ${SVCNAME}" - start-stop-daemon --stop --pidfile "${SYSLOG_NG_PIDFILE}" - eend $? "Failed to stop ${SVCNAME}" - sleep 1 # needed for syslog-ng to stop in case we're restarting +stop_post() { + [ "$RC_CMD" = restart ] && sleep 1 + return 0 } reload() { - if [ ! -f "${SYSLOG_NG_PIDFILE}" ]; then - eerror "${SVCNAME} isn't running" - return 1 - fi checkconfig || return 1 ebegin "Reloading configuration and re-opening log files" - start-stop-daemon --signal HUP --pidfile "${SYSLOG_NG_PIDFILE}" + start-stop-daemon --signal HUP --pidfile "${pidfile}" eend $? }