diff options
Diffstat (limited to 'meta/recipes-core/sysvinit/sysvinit/bootlogd.init')
-rwxr-xr-x | meta/recipes-core/sysvinit/sysvinit/bootlogd.init | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/meta/recipes-core/sysvinit/sysvinit/bootlogd.init b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init new file mode 100755 index 0000000000..7b87827fdf --- /dev/null +++ b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init | |||
@@ -0,0 +1,92 @@ | |||
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 | # source function library | ||
17 | . /etc/init.d/functions | ||
18 | |||
19 | test -f $DAEMON || exit 0 | ||
20 | |||
21 | [ -r /etc/default/bootlogd ] && . /etc/default/bootlogd | ||
22 | |||
23 | ## set -e # not needed | ||
24 | |||
25 | case "$BOOTLOGD_ENABLE" in | ||
26 | [Nn]*) | ||
27 | exit 0 | ||
28 | ;; | ||
29 | esac | ||
30 | |||
31 | STOPPER= | ||
32 | ACTION="$1" | ||
33 | case "$0" in | ||
34 | *stop-bootlog*) | ||
35 | STOPPER=Y | ||
36 | if [ "$ACTION" = start ] | ||
37 | then | ||
38 | ACTION=stop | ||
39 | fi | ||
40 | ;; | ||
41 | esac | ||
42 | |||
43 | case "$ACTION" in | ||
44 | start) | ||
45 | echo -n "Starting $DESC: " | ||
46 | if [ -d /proc/1/. ] | ||
47 | then | ||
48 | umask 027 | ||
49 | start-stop-daemon --start --quiet \ | ||
50 | --exec $DAEMON -- -r | ||
51 | else | ||
52 | $DAEMON -r | ||
53 | fi | ||
54 | echo "$NAME." | ||
55 | ;; | ||
56 | stop) | ||
57 | echo -n "Stopping $DESC: " | ||
58 | start-stop-daemon --stop --quiet --exec $DAEMON | ||
59 | |||
60 | if [ "$STOPPER" ] && [ -f /var/log/boot ] && \ | ||
61 | [ -f /var/log/boot~ ] | ||
62 | then | ||
63 | cd /var/log | ||
64 | chgrp adm boot | ||
65 | savelog -p -c 5 boot > /dev/null 2>&1 | ||
66 | mv boot.0 boot | ||
67 | mv boot~ boot.0 | ||
68 | fi | ||
69 | |||
70 | echo "$NAME." | ||
71 | ;; | ||
72 | restart|force-reload) | ||
73 | echo -n "Restarting $DESC: " | ||
74 | start-stop-daemon --stop --quiet --exec $DAEMON | ||
75 | sleep 1 | ||
76 | start-stop-daemon --start --quiet --exec $DAEMON | ||
77 | echo "$NAME." | ||
78 | ;; | ||
79 | status) | ||
80 | status $DAEMON | ||
81 | exit $? | ||
82 | ;; | ||
83 | *) | ||
84 | N=${0##*/} | ||
85 | N=${N#[SK]??} | ||
86 | echo "Usage: $N {start|stop|status|restart|force-reload}" >&2 | ||
87 | exit 1 | ||
88 | ;; | ||
89 | esac | ||
90 | |||
91 | exit 0 | ||
92 | |||