2008-07-11 11:37:05 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# rsyslog Starts rsyslogd/rklogd.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# 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
|
2009-09-14 16:54:26 +00:00
|
|
|
PIDFILE=/var/run/syslogd.pid
|
|
|
|
|
|
|
|
prog=rsyslogd
|
|
|
|
exec=/sbin/rsyslogd
|
|
|
|
lockfile=/var/lock/subsys/$prog
|
2008-07-11 11:37:05 +00:00
|
|
|
|
|
|
|
start() {
|
2009-09-14 16:54:26 +00:00
|
|
|
[ -x $exec ] || exit 5
|
2008-07-11 11:37:05 +00:00
|
|
|
|
|
|
|
# Source config
|
|
|
|
if [ -f /etc/sysconfig/rsyslog ] ; then
|
|
|
|
. /etc/sysconfig/rsyslog
|
|
|
|
fi
|
|
|
|
umask 077
|
|
|
|
|
|
|
|
echo -n $"Starting system logger: "
|
2009-09-14 16:54:26 +00:00
|
|
|
daemon --pidfile="${PIDFILE}" $exec $SYSLOGD_OPTIONS
|
2008-07-11 11:37:05 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo
|
2009-09-14 16:54:26 +00:00
|
|
|
[ $RETVAL -eq 0 ] && touch $lockfile
|
2008-07-11 11:37:05 +00:00
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
stop() {
|
|
|
|
echo -n $"Shutting down system logger: "
|
2009-09-14 16:54:26 +00:00
|
|
|
killproc $prog
|
2008-07-11 11:37:05 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo
|
2009-09-14 16:54:26 +00:00
|
|
|
[ $RETVAL -eq 0 ] && rm -f $lockfile
|
2008-07-11 11:37:05 +00:00
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
reload() {
|
|
|
|
RETVAL=1
|
2009-09-14 16:54:26 +00:00
|
|
|
syslog=$(cat "${PIDFILE}" 2>/dev/null)
|
2008-07-11 11:37:05 +00:00
|
|
|
echo -n "Reloading system logger..."
|
|
|
|
if [ -n "${syslog}" ] && [ -e /proc/"${syslog}" ]; then
|
|
|
|
kill -HUP "$syslog";
|
|
|
|
RETVAL=$?
|
|
|
|
fi
|
|
|
|
if [ $RETVAL -ne 0 ]; then
|
|
|
|
failure
|
|
|
|
else
|
|
|
|
success
|
|
|
|
fi
|
|
|
|
echo
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
rhstatus() {
|
2009-09-14 16:54:26 +00:00
|
|
|
status -p "${PIDFILE}" $prog
|
2008-07-11 11:37:05 +00:00
|
|
|
}
|
|
|
|
restart() {
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
restart
|
|
|
|
;;
|
|
|
|
reload|force-reload)
|
|
|
|
reload
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
rhstatus
|
|
|
|
;;
|
2009-09-14 16:54:26 +00:00
|
|
|
condrestart|try-restart)
|
|
|
|
rhstatus >/dev/null 2>&1 || exit 0
|
|
|
|
restart
|
2008-07-11 11:37:05 +00:00
|
|
|
;;
|
|
|
|
*)
|
2009-09-14 16:54:26 +00:00
|
|
|
echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status}"
|
|
|
|
exit 3
|
2008-07-11 11:37:05 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit $?
|