You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.1 KiB
65 lines
2.1 KiB
11 years ago
|
#!/sbin/runscript
|
||
|
# Copyright 1999-2013 Gentoo Foundation
|
||
|
# Distributed under the terms of the GNU General Public License v2
|
||
|
# $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/3.4/syslog-ng.rc6,v 1.1 2013/04/28 04:50:34 mr_bones_ Exp $
|
||
|
|
||
|
SYSLOG_NG_CONFIGFILE=${SYSLOG_NG_CONFIGFILE:-/etc/syslog-ng/${RC_SVCNAME}.conf}
|
||
|
SYSLOG_NG_STATEFILE_DIR=${SYSLOG_NG_PIDFILE_DIR:-/var/lib/syslog-ng}
|
||
|
SYSLOG_NG_STATEFILE=${SYSLOG_NG_STATEFILE:-${SYSLOG_NG_STATEFILE_DIR}/syslog-ng.persist}
|
||
|
SYSLOG_NG_PIDFILE_DIR=${SYSLOG_NG_PIDFILE_DIR:-/var/run}
|
||
|
SYSLOG_NG_PIDFILE=${SYSLOG_NG_PIDFILE:-${SYSLOG_NG_PIDFILE_DIR}/${RC_SVCNAME}.pid}
|
||
|
|
||
|
SYSLOG_NG_GROUP=${SYSLOG_NG_GROUP:-root}
|
||
|
SYSLOG_NG_USER=${SYSLOG_NG_USER:-root}
|
||
|
|
||
|
command="syslog-ng"
|
||
|
command_args="--persist-file \"${SYSLOG_NG_STATEFILE}\" --cfgfile \"${SYSLOG_NG_CONFIGFILE}\" --pidfile \"${SYSLOG_NG_PIDFILE}\" ${SYSLOG_NG_OPTS}"
|
||
|
extra_commands="checkconfig"
|
||
|
extra_started_commands="reload"
|
||
|
pidfile="${SYSLOG_NG_PIDFILE}"
|
||
|
start_stop_daemon_args="--user \"${SYSLOG_NG_USER}\":\"${SYSLOG_NG_GROUP}\""
|
||
|
description="Syslog-ng is a syslog replacement with advanced filtering features."
|
||
|
description_checkconfig="Check the configuration file that will be used by \"start\""
|
||
|
description_reload="Reload the configuration without exiting"
|
||
|
|
||
|
depend() {
|
||
|
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
|
||
|
config "${SYSLOG_NG_CONFIGFILE}"
|
||
|
use clock
|
||
|
need hostname localmount
|
||
|
after bootmisc
|
||
|
provide logger
|
||
|
}
|
||
|
|
||
|
checkconfig() {
|
||
|
ebegin "Checking your configfile (${SYSLOG_NG_CONFIGFILE})"
|
||
|
syslog-ng -s -f "${SYSLOG_NG_CONFIGFILE}"
|
||
|
eend $? "Configuration error. Please fix your configfile (${SYSLOG_NG_CONFIGFILE})"
|
||
|
}
|
||
|
|
||
|
start_pre() {
|
||
|
checkconfig || return 1
|
||
|
checkpath \
|
||
|
-d \
|
||
|
--mode 0600 \
|
||
|
--owner "${SYSLOG_NG_OWNER}:${SYSLOG_NG_GROUP}" \
|
||
|
"${SYSLOG_NG_STATEFILE_DIR}"
|
||
|
}
|
||
|
|
||
|
stop_pre() {
|
||
|
[ "$RC_CMD" = restart ] && sleep 1
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
reload() {
|
||
|
checkconfig || return 1
|
||
|
ebegin "Reloading configuration and re-opening log files"
|
||
|
start-stop-daemon --signal HUP --pidfile "${pidfile}"
|
||
|
eend $?
|
||
|
}
|