Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 1 | #! /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 | |
| 11 | syslog_ng=/usr/sbin/syslog-ng |
| 12 | test -x "$syslog_ng" || exit 0 |
| 13 | |
| 14 | PIDFILE=/var/run/syslog-ng/syslog-ng.pid |
| 15 | |
| 16 | create_xconsole() { |
| 17 | test -e /dev/xconsole || mknod -m 640 /dev/xconsole p |
| 18 | test -x /sbin/restorecon && /sbin/restorecon /dev/xconsole |
| 19 | } |
| 20 | |
| 21 | RETVAL=0 |
| 22 | |
| 23 | case "$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 |
| 60 | esac |
| 61 | |
| 62 | exit $RETVAL |