summaryrefslogtreecommitdiffstats
path: root/build/rhel/rsyslog/rsyslog.init
diff options
context:
space:
mode:
Diffstat (limited to 'build/rhel/rsyslog/rsyslog.init')
-rw-r--r--build/rhel/rsyslog/rsyslog.init121
1 files changed, 121 insertions, 0 deletions
diff --git a/build/rhel/rsyslog/rsyslog.init b/build/rhel/rsyslog/rsyslog.init
new file mode 100644
index 0000000..ed4b1b1
--- /dev/null
+++ b/build/rhel/rsyslog/rsyslog.init
@@ -0,0 +1,121 @@
+#!/bin/bash
+#
+# rsyslog Startup script for rsyslog.
+#
+# chkconfig: 2345 12 88
+# description: Syslog is the facility by which many daemons use to log \
+# messages to various system log files. It is a good idea to always \
+# run rsyslog.
+### BEGIN INIT INFO
+# Provides: $syslog
+# Required-Start: $local_fs
+# Required-Stop: $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Enhanced system logging and kernel message trapping daemons
+# Description: Rsyslog is an enhanced multi-threaded syslogd supporting,
+# among others, MySQL, syslog/tcp, RFC 3195, permitted
+# sender lists, filtering on any message part, and fine
+# grain output format control.
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+RETVAL=0
+PIDFILE=/var/run/syslogd.pid
+
+prog=rsyslog
+exec=/sbin/rsyslogd
+lockfile=/var/lock/subsys/$prog
+
+# Source config
+if [ -f /etc/sysconfig/$prog ] ; then
+ . /etc/sysconfig/$prog
+fi
+
+start() {
+ [ -x $exec ] || exit 5
+
+ umask 077
+
+ syntaxcheck
+
+ RETVAL=$?
+ if [ $RETVAL -ne 0 ] ; then
+ echo "Refusing to start system logger due to syntax errors; correct to continue."
+ return $RETVAL
+ fi
+
+ echo -n $"Starting rsyslog: "
+ daemon --pidfile="${PIDFILE}" $exec -i "${PIDFILE}" $SYSLOGD_OPTIONS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch $lockfile
+ return $RETVAL
+}
+stop() {
+ echo -n $"Shutting down system logger: "
+ killproc -p "${PIDFILE}" $exec
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f $lockfile
+ return $RETVAL
+}
+rhstatus() {
+ status -p "${PIDFILE}" -l $prog $exec
+}
+restart() {
+ stop
+ start
+}
+
+syntaxcheck() {
+ [ -x $exec ] || exit 5
+
+ echo "Checking rsyslog configuration syntax: "
+ $exec $SYSLOGD_OPTIONS -n -N1
+ echo
+
+ RETVAL=$?
+
+ if [ $RETVAL -eq 0 ] ; then
+ echo "syntax is okay"
+ else
+ echo "configuration has syntax errors"
+ fi
+ return $RETVAL
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ reload)
+ exit 3
+ ;;
+ force-reload)
+ restart
+ ;;
+ status)
+ rhstatus
+ ;;
+ condrestart|try-restart)
+ rhstatus >/dev/null 2>&1 || exit 0
+ restart
+ ;;
+ syntaxcheck)
+ syntaxcheck
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status}"
+ exit 3
+esac
+
+exit $?