| 1 | #!/bin/sh |
| 2 | # |
| 3 | # /etc/rc.d/sysklogd: start/stop syslog and klog daemons |
| 4 | # |
| 5 | |
| 6 | SSD=/sbin/start-stop-daemon |
| 7 | SLOG=/usr/sbin/syslogd |
| 8 | KLOG=/usr/sbin/klogd |
| 9 | SLOG_PID=/var/run/syslogd.pid |
| 10 | KLOG_PID=/var/run/klogd.pid |
| 11 | |
| 12 | |
| 13 | print_status() { |
| 14 | $SSD --status --pidfile $2 |
| 15 | case $? in |
| 16 | 0) echo "$1 is running with pid $(cat $2)" ;; |
| 17 | 1) echo "$1 is not running but the pid file $2 exists" ;; |
| 18 | 3) echo "$1 is not running" ;; |
| 19 | 4) echo "Unable to determine the program status" ;; |
| 20 | esac |
| 21 | } |
| 22 | |
| 23 | case $1 in |
| 24 | start) |
| 25 | $SSD --start --pidfile $SLOG_PID --exec $SLOG |
| 26 | $SSD --start --pidfile $KLOG_PID --exec $KLOG -- -c4 |
| 27 | ;; |
| 28 | stop) |
| 29 | $SSD --stop --retry 10 --pidfile $SLOG_PID |
| 30 | $SSD --stop --retry 10 --pidfile $KLOG_PID |
| 31 | ;; |
| 32 | restart) |
| 33 | $0 stop |
| 34 | $0 start |
| 35 | ;; |
| 36 | status) |
| 37 | print_status $SLOG $SLOG_PID |
| 38 | print_status $KLOG $KLOG_PID |
| 39 | ;; |
| 40 | *) |
| 41 | echo "usage: $0 [start|stop|restart|status]" |
| 42 | ;; |
| 43 | esac |
| 44 | |
| 45 | # End of file |