1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#! /bin/sh
# /etc/init.d/klogd: start the kernel log daemon.
PATH=/bin:/usr/bin:/sbin:/usr/sbin
pidfile=/var/run/klogd.pid
binpath=/sbin/klogd
test -f $binpath || exit 0
test ! -r /etc/default/klogd || . /etc/default/klogd
running()
{
# No pidfile, probably no daemon present
#
if [ ! -f $pidfile ]
then
return 1
fi
pid=`cat $pidfile`
# No pid, probably no daemon present
#
if [ -z "$pid" ]
then
return 1
fi
if [ ! -d /proc/$pid ]
then
return 1
fi
cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1`
# No syslogd?
#
if [ "$cmd" != "$binpath" ]
then
return 1
fi
return 0
}
case "$1" in
start)
echo -n "Starting kernel log daemon: klogd"
start-stop-daemon --start --quiet --exec $binpath -- $KLOGD
echo "."
;;
stop)
echo -n "Stopping kernel log daemon: klogd"
start-stop-daemon --stop --retry TERM/1/TERM/1/TERM/4/KILL --quiet --exec $binpath --pidfile $pidfile
echo "."
;;
restart|force-reload)
echo -n "Restarting kernel log daemon: klogd"
start-stop-daemon --stop --retry TERM/1/TERM/1/TERM/4/KILL --quiet --exec $binpath --pidfile $pidfile
start-stop-daemon --start --quiet --exec $binpath -- $KLOGD
echo "."
;;
*)
echo "Usage: /etc/init.d/klogd {start|stop|restart|force-reload}"
exit 1
esac
exit 0
|