summaryrefslogtreecommitdiffstats
path: root/openwrt/package/syslog-ng/files/syslog-ng.init
blob: 40472ed3b990361ce48e6c680a8837c73815293b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh

syslog_start() {
  [ -f /etc/syslog-ng/syslog-ng.conf ] || {
    echo "/etc/syslog-ng/syslog-ng.conf does not exist !";
    exit 0;
  };
  [ -d /var/run ] || mkdir -p /var/run
  [ -x /usr/sbin/syslog-ng ] && /usr/sbin/syslog-ng
}

syslog_stop() {
  killall syslog-ng
}

case "$1" in
  start)
	syslog_start
	;;
  stop)
	syslog_stop
	;;
  restart)
	syslog_stop
	sleep 1s
	syslog_start
	;;
  reload)
	kill -HUP `cat /var/run/syslog-ng.pid` &>/dev/null
	;;
  *)
	echo "Usage: $0 <start|stop|restart|reload>"
	;;
esac