CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
libmpfr: updated to 4.0.1
[crossrootfs.git] / sysklogd / sysklogd
index d14870cae1e0598757297c211d5904142a6a52b2..90a0835253d5b51f34a4d70f0cebf17c8c13207e 100644 (file)
@@ -1,23 +1,45 @@
 #!/bin/sh
 #
-# /etc/rc.d/sysklogd: start/stop sysklogd logging daemons
+# /etc/rc.d/sysklogd: start/stop syslog and klog daemons
 #
 
+SSD=/sbin/start-stop-daemon
+SLOG=/usr/sbin/syslogd
+KLOG=/usr/sbin/klogd
+SLOG_PID=/var/run/syslogd.pid
+KLOG_PID=/var/run/klogd.pid
+
+
+print_status() {
+       $SSD --status --pidfile $2
+       case $? in
+       0) echo "$1 is running with pid $(cat $2)" ;;
+       1) echo "$1 is not running but the pid file $2 exists" ;;
+       3) echo "$1 is not running" ;;
+       4) echo "Unable to determine the program status" ;;
+       esac
+}
+
 case $1 in
 start)
-       /usr/sbin/syslogd
-       /usr/sbin/klogd -c 3
+       $SSD --start --pidfile $SLOG_PID --exec $SLOG
+       $SSD --start --pidfile $KLOG_PID --exec $KLOG -- -c4
        ;;
 stop)
-       /usr/bin/killall syslogd
-       /usr/bin/killall klogd
+       $SSD --stop --retry 10 --pidfile $SLOG_PID 
+       $SSD --stop --retry 10 --pidfile $KLOG_PID 
        ;;
 restart)
        $0 stop
-       sleep 2
        $0 start
        ;;
+status)
+       print_status $SLOG $SLOG_PID
+       print_status $KLOG $KLOG_PID
+       ;;
 *)
-       echo "usage: $0 [start|stop|restart]"
+       echo "usage: $0 [start|stop|restart|status]"
        ;;
 esac
+
+# End of file