diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
commit | c527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch) | |
tree | bb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /meta/recipes-core/sysvinit/sysvinit/bootlogd.init | |
download | poky-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-core/sysvinit/sysvinit/bootlogd.init')
-rwxr-xr-x | meta/recipes-core/sysvinit/sysvinit/bootlogd.init | 96 |
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 0000000000..7d6518d981 --- /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 | |||
15 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
16 | DAEMON=/sbin/bootlogd | ||
17 | NAME=bootlogd | ||
18 | DESC="Bootlog daemon" | ||
19 | |||
20 | # source function library | ||
21 | . /etc/init.d/functions | ||
22 | |||
23 | test -f $DAEMON || exit 0 | ||
24 | |||
25 | [ -r /etc/default/bootlogd ] && . /etc/default/bootlogd | ||
26 | |||
27 | ## set -e # not needed | ||
28 | |||
29 | case "$BOOTLOGD_ENABLE" in | ||
30 | [Nn]*) | ||
31 | exit 0 | ||
32 | ;; | ||
33 | esac | ||
34 | |||
35 | STOPPER= | ||
36 | ACTION="$1" | ||
37 | case "$0" in | ||
38 | *stop-bootlog*) | ||
39 | STOPPER=Y | ||
40 | if [ "$ACTION" = start ] | ||
41 | then | ||
42 | ACTION=stop | ||
43 | fi | ||
44 | ;; | ||
45 | esac | ||
46 | |||
47 | case "$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 | ;; | ||
93 | esac | ||
94 | |||
95 | exit 0 | ||
96 | |||