summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/busybox/files/syslog
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/busybox/files/syslog')
-rw-r--r--meta/recipes-core/busybox/files/syslog77
1 files changed, 77 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/files/syslog b/meta/recipes-core/busybox/files/syslog
new file mode 100644
index 0000000..2944d3d
--- /dev/null
+++ b/meta/recipes-core/busybox/files/syslog
@@ -0,0 +1,77 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: sysklogd
4# Required-Start: $remote_fs $time
5# Required-Stop: $remote_fs $time
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: System logger
9### END INIT INFO
10
11set -e
12
13if [ -f /etc/syslog-startup.conf ]; then
14 . /etc/syslog-startup.conf
15 LOG_LOCAL=0
16 LOG_REMOTE=0
17 for D in $DESTINATION; do
18 if [ "$D" = "buffer" ]; then
19 SYSLOG_ARGS="$SYSLOG_ARGS -C$BUFFERSIZE"
20 LOG_LOCAL=1
21 elif [ "$D" = "file" ]; then
22 if [ -n "$LOGFILE" ]; then
23 SYSLOG_ARGS="$SYSLOG_ARGS -O $LOGFILE"
24 fi
25 if [ -n "$ROTATESIZE" ]; then
26 SYSLOG_ARGS="$SYSLOG_ARGS -s $ROTATESIZE"
27 fi
28 if [ -n "$ROTATEGENS" ]; then
29 SYSLOG_ARGS="$SYSLOG_ARGS -b $ROTATEGENS"
30 fi
31 LOCAL=0
32 elif [ "$D" = "remote" ]; then
33 SYSLOG_ARGS="$SYSLOG_ARGS -R $REMOTE"
34 LOG_REMOTE=1
35 fi
36 done
37 if [ "$LOG_LOCAL" = "1" -a "$LOG_REMOTE" = "1" ]; then
38 SYSLOG_ARGS="$SYSLOG_ARGS -L"
39 fi
40 if [ "$REDUCE" = "yes" ]; then
41 SYSLOG_ARGS="$SYSLOG_ARGS -S"
42 fi
43 if [ "$DROPDUPLICATES" = "yes" ]; then
44 SYSLOG_ARGS="$SYSLOG_ARGS -D"
45 fi
46 if [ -n "$LOGLEVEL" ]; then
47 SYSLOG_ARGS="$SYSLOG_ARGS -l $LOGLEVEL"
48 fi
49else
50 # default: log to 16K shm circular buffer
51 SYSLOG_ARGS="-C"
52fi
53
54case "$1" in
55 start)
56 echo -n "Starting syslogd/klogd: "
57 start-stop-daemon -S -b -n syslogd -a /sbin/syslogd -- -n $SYSLOG_ARGS
58 start-stop-daemon -S -b -n klogd -a /sbin/klogd -- -n
59 echo "done"
60 ;;
61 stop)
62 echo -n "Stopping syslogd/klogd: "
63 start-stop-daemon -K -n syslogd
64 start-stop-daemon -K -n klogd
65 echo "done"
66 ;;
67 restart)
68 $0 stop
69 $0 start
70 ;;
71 *)
72 echo "Usage: syslog { start | stop | restart }" >&2
73 exit 1
74 ;;
75esac
76
77exit 0