40472ed3b990361ce48e6c680a8837c73815293b
[openwrt/svn-archive/archive.git] / admin / syslog-ng / files / syslog-ng.init
1 #!/bin/sh
2
3 syslog_start() {
4 [ -f /etc/syslog-ng/syslog-ng.conf ] || {
5 echo "/etc/syslog-ng/syslog-ng.conf does not exist !";
6 exit 0;
7 };
8 [ -d /var/run ] || mkdir -p /var/run
9 [ -x /usr/sbin/syslog-ng ] && /usr/sbin/syslog-ng
10 }
11
12 syslog_stop() {
13 killall syslog-ng
14 }
15
16 case "$1" in
17 start)
18 syslog_start
19 ;;
20 stop)
21 syslog_stop
22 ;;
23 restart)
24 syslog_stop
25 sleep 1s
26 syslog_start
27 ;;
28 reload)
29 kill -HUP `cat /var/run/syslog-ng.pid` &>/dev/null
30 ;;
31 *)
32 echo "Usage: $0 <start|stop|restart|reload>"
33 ;;
34 esac