#! /usr/bin/busybox ash # # init.d script with LSB support. # # Copyright (c) 2007 Javier Fernandez-Sanguino # Copyright (c) 2008 Axel Beckert # Copyright (c) 2023 Michael Tokarev # # This is free software; you may redistribute it and/or modify # it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2, # or (at your option) any later version. # # This is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License with # the Debian operating system, in /usr/share/common-licenses/GPL; if # not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA # ### BEGIN INIT INFO # Provides: busybox-klogd klogd # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: syslogd # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts klogd # Description: Starts the busybox kernel logger klogd ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin NAME=klogd DAEMON=/sbin/$NAME DESC="busybox' $NAME implementation" test -x $DAEMON || exit 0 . /lib/lsb/init-functions KLOG_OPTS= # Additional options given to the server # Include defaults if available if [ -f /etc/default/busybox-syslogd ] ; then . /etc/default/busybox-syslogd fi server() { case "$1" in (start) args="-S -o" ;; (stop) args="-K -o -q" ;; (check) args="-K -t -q" ;; esac busybox start-stop-daemon $args -p /var/run/$NAME.pid \ -x $DAEMON -- $KLOGD_OPTS } case "$1" in start) log_daemon_msg "Starting $DESC " "$NAME" if server start ; then log_end_msg 0 else log_end_msg 1 exit 1 fi ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if server stop ; then log_end_msg 0 else log_end_msg 1 exit 1 fi ;; restart|force-reload) "$0" stop exec "$0" start ;; status) log_daemon_msg "Checking status of $DESC" "$NAME" if server check ; then log_progress_msg "running" log_end_msg 0 else log_progress_msg "apparently not running" log_end_msg 1 exit 1 fi ;; *) echo "Usage: /etc/init.d/busybox-$NAME {start|stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0