3 # syslog Starts syslog-ng (syslogd replacement).
5 # chkconfig: 2345 17 83
6 # description: Syslog is the facility by which many daemons use to log \
7 # messages to various system log files. It is a good idea to \
10 # Source function library
11 . /etc/rc.d/init.d/functions
14 ENABLE_RECEIVE_FROM_NET=no
20 if [ -f /etc/sysconfig/syslog-ng ]; then
21 . /etc/sysconfig/syslog-ng
25 # must return non-zero if check failed
26 # output is discarded if checkconfig is ran without details
28 syslog-ng $OPTIONS -F -s -p /var/run/syslog-ng-syntaxcheck.pid
32 # wrapper for configtest
36 if [ $details = 1 ]; then
37 # run config test and display report (status action)
38 show "Checking %s configuration" "syslog-ng"; busy
40 out=$(configtest 2>&1)
42 if [ $RETVAL = 0 ]; then
47 [ "$out" ] && echo >&2 "$out"
49 # run config test and abort with nice message if failed
50 # (for actions checking status before action).
51 configtest >/dev/null 2>&1
53 if [ $RETVAL != 0 ]; then
54 show "Checking %s configuration" "syslog-ng"; fail
55 nls 'Configuration test failed. See details with %s "checkconfig"' $0
62 # Check if the service is already running?
63 if [ -f /var/lock/subsys/syslog-ng ]; then
64 msg_already_running "syslog-ng"
68 msg_starting "syslog-ng"
69 emit starting JOB=syslog-ng SERVICE=syslog
70 daemon /usr/sbin/syslog-ng -f /etc/syslog-ng/syslog-ng.conf $OPTIONS
71 emit --no-wait started JOB=syslog-ng SERVICE=syslog
73 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/syslog-ng
77 if [ ! -f /var/lock/subsys/syslog-ng ]; then
78 msg_not_running "syslog-ng"
82 msg_stopping "syslog-ng"
83 emit stopping JOB=syslog-ng SERVICE=syslog
85 emit --no-wait stopped JOB=syslog-ng SERVICE=syslog
86 rm -f /var/lock/subsys/syslog-ng >/dev/null 2>&1
90 if [ ! -f /var/lock/subsys/syslog-ng ]; then
91 msg_not_running "syslog-ng"
102 if [ ! -f /var/lock/subsys/syslog-ng ]; then
103 msg_not_running "syslog-ng"
109 msg_reloading "syslog-ng"
110 killproc syslog-ng -HUP
115 if use_upstart && [ -f /etc/init/syslog-ng.conf ]; then
116 /sbin/initctl reload syslog-ng
117 elif [ -f /var/lock/subsys/syslog-ng ]; then
119 msg_reloading "syslog-ng"
120 killproc syslog-ng -HUP
123 msg_not_running "syslog-ng"
128 upstart_controlled --except checkconfig configtest flush-logs
131 # See how we were called.
154 checkconfig|configtest)
162 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status|checkconfig|flush-logs}"