]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/sysvinit/sysvinit/bootlogd.init
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / sysvinit / sysvinit / bootlogd.init
1 #! /bin/sh
2 #
3 # bootlogd      One of the first scripts to be executed. Starts or stops
4 #               the bootlogd log program. If this script is called as
5 #               "stop-bootlogd", it will stop the daemon instead of
6 #               starting it even when called with the "start" argument.
7 #
8 # Version:      @(#)bootlogd  2.85-12  21-Mar-2004  miquels@cistron.nl
9 #
10
11 PATH=/sbin:/bin:/usr/sbin:/usr/bin
12 DAEMON=/sbin/bootlogd
13 NAME=bootlogd
14 DESC="Bootlog daemon"
15
16 test -f $DAEMON || exit 0
17
18 [ -r /etc/default/bootlogd ] && . /etc/default/bootlogd
19
20 ## set -e # not needed
21
22 case "$BOOTLOGD_ENABLE" in
23         [Nn]*)
24                 exit 0
25                 ;;
26 esac
27
28 STOPPER=
29 ACTION="$1"
30 case "$0" in
31         *stop-bootlog*)
32                 STOPPER=Y
33                 if [ "$ACTION" = start ]
34                 then
35                         ACTION=stop
36                 fi
37                 ;;
38 esac
39
40 case "$ACTION" in
41         start)
42                 echo -n "Starting $DESC: "
43                 if [ -d /proc/1/. ]
44                 then
45                         umask 027
46                         start-stop-daemon --start --quiet \
47                                 --exec $DAEMON -- -r
48                 else
49                         $DAEMON -r
50                 fi
51                 echo "$NAME."
52                 ;;
53         stop)
54                 echo -n "Stopping $DESC: "
55                 start-stop-daemon --stop --quiet --exec $DAEMON
56
57                 if [ "$STOPPER" ] && [ -f /var/log/boot ] && \
58                    [ -f /var/log/boot~ ]
59                 then
60                         cd /var/log
61                         chgrp adm boot
62                         savelog -p -c 5 boot > /dev/null 2>&1
63                         mv boot.0 boot
64                         mv boot~ boot.0
65                 fi
66
67                 echo "$NAME."
68                 ;;
69          restart|force-reload)
70                 echo -n "Restarting $DESC: "
71                 start-stop-daemon --stop --quiet --exec $DAEMON
72                 sleep 1
73                 start-stop-daemon --start --quiet --exec $DAEMON
74                 echo "$NAME."
75                 ;;
76         *)
77                 N=${0##*/}
78                 N=${N#[SK]??}
79                 echo "Usage: $N {start|stop|restart|force-reload}" >&2
80                 exit 1
81                 ;;
82 esac
83
84 exit 0
85