summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/sysvinit/sysvinit/bootlogd.init')
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/bootlogd.init96
1 files changed, 96 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 0000000..7d6518d
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
@@ -0,0 +1,96 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: bootlogd
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop: 2 3 4 5
8# Short-Description: One of the first scripts to be executed. Starts or stops
9# the bootlogd log program. If this script is called as
10# "stop-bootlogd", it will stop the daemon instead of
11# starting it even when called with the "start" argument.
12#
13### END INIT INFO
14
15PATH=/sbin:/bin:/usr/sbin:/usr/bin
16DAEMON=/sbin/bootlogd
17NAME=bootlogd
18DESC="Bootlog daemon"
19
20# source function library
21. /etc/init.d/functions
22
23test -f $DAEMON || exit 0
24
25[ -r /etc/default/bootlogd ] && . /etc/default/bootlogd
26
27## set -e # not needed
28
29case "$BOOTLOGD_ENABLE" in
30 [Nn]*)
31 exit 0
32 ;;
33esac
34
35STOPPER=
36ACTION="$1"
37case "$0" in
38 *stop-bootlog*)
39 STOPPER=Y
40 if [ "$ACTION" = start ]
41 then
42 ACTION=stop
43 fi
44 ;;
45esac
46
47case "$ACTION" in
48 start)
49 echo -n "Starting $DESC: "
50 if [ -d /proc/1/. ]
51 then
52 umask 027
53 start-stop-daemon --start --quiet \
54 --exec $DAEMON -- -r -c
55 else
56 $DAEMON -r -c
57 fi
58 echo "$NAME."
59 ;;
60 stop)
61 echo -n "Stopping $DESC: "
62 start-stop-daemon --stop --quiet --exec $DAEMON
63
64 if [ "$STOPPER" ] && [ -f /var/log/boot ] && \
65 [ -f /var/log/boot~ ]
66 then
67 cd /var/log
68 chgrp adm boot
69 savelog -p -c 5 boot > /dev/null 2>&1
70 mv boot.0 boot
71 mv boot~ boot.0
72 fi
73
74 echo "$NAME."
75 ;;
76 restart|force-reload)
77 echo -n "Restarting $DESC: "
78 start-stop-daemon --stop --quiet --exec $DAEMON
79 sleep 1
80 start-stop-daemon --start --quiet --exec $DAEMON
81 echo "$NAME."
82 ;;
83 status)
84 status $DAEMON
85 exit $?
86 ;;
87 *)
88 N=${0##*/}
89 N=${N#[SK]??}
90 echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
91 exit 1
92 ;;
93esac
94
95exit 0
96