blob: 910030f41dec60f06deee7571c5cb0ee2e732e24 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001#! /bin/sh
2#
3# This is an init script for openembedded
4# Copy it to /etc/init.d/syslog-ng and type
5# > update-rc.d syslog-ng defaults 5
6#
7
8# Source function library
9. /etc/init.d/functions
10
11syslog_ng=/usr/sbin/syslog-ng
12test -x "$syslog_ng" || exit 0
13
14PIDFILE=/var/run/syslog-ng/syslog-ng.pid
15
16create_xconsole() {
17 test -e /dev/xconsole || mknod -m 640 /dev/xconsole p
18 test -x /sbin/restorecon && /sbin/restorecon /dev/xconsole
19}
20
21RETVAL=0
22
23case "$1" in
24 start)
25 [ "${VERBOSE}" != "no" ] && echo -n "Starting syslog-ng:"
26 create_xconsole
27 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $syslog_ng
28 [ "${VERBOSE}" != "no" ] && echo "."
29 ;;
30 stop)
31 [ "${VERBOSE}" != "no" ] && echo -n "Stopping syslog-ng:"
32 start-stop-daemon --stop --quiet --pidfile $PIDFILE
33 [ "${VERBOSE}" != "no" ] && echo "."
34 ;;
35 reload|force-reload)
36 start-stop-daemon --stop --quiet --signal 1 --exec $syslog_ng
37 ;;
38 restart)
39 echo "Stopping syslog-ng:"
40 start-stop-daemon --stop --quiet --pidfile $PIDFILE
41 echo -n "Waiting for syslog-ng to die off"
42 for i in 1 2 3 ;
43 do
44 sleep 1
45 echo -n "."
46 done
47 echo ""
48 echo -n "Starting syslog-ng:"
49 create_xconsole
50 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $syslog_ng
51 echo "."
52 ;;
53 status)
54 status $syslog_ng
55 RETVAL=$?
56 ;;
57 *)
58 echo "Usage: $0 {start|stop|reload|restart|force-reload|status}"
59 exit 1
60esac
61
62exit $RETVAL