diff options
Diffstat (limited to 'packages/busybox/files')
-rw-r--r-- | packages/busybox/files/syslog | 69 | ||||
-rw-r--r-- | packages/busybox/files/syslog.conf | 0 |
2 files changed, 69 insertions, 0 deletions
diff --git a/packages/busybox/files/syslog b/packages/busybox/files/syslog index e69de29bb2..44698c5ce2 100644 --- a/packages/busybox/files/syslog +++ b/packages/busybox/files/syslog @@ -0,0 +1,69 @@ +#! /bin/sh +# +# syslog init.d script for busybox syslogd/klogd +# Written by Robert Griebl <sandman@handhelds.org> +# Configuration file added by <bruno.randolf@4g-systems.biz> +set -e + +if [ -f /etc/syslog.conf ]; then + . /etc/syslog.conf + LOG_LOCAL=0 + LOG_REMOTE=0 + for D in $DESTINATION; do + if [ "$D" == "buffer" ]; then + SYSLOG_ARGS="$SYSLOG_ARGS -C $BUFFERSIZE" + LOG_LOCAL=1 + elif [ "$D" == "file" ]; then + if [ -n "$LOGFILE" ]; then + SYSLOG_ARGS="$SYSLOG_ARGS -O $LOGFILE" + fi + if [ -n "$ROTATESIZE" ]; then + SYSLOG_ARGS="$SYSLOG_ARGS -s $ROTATESIZE" + fi + if [ -n "$ROTATEGENS" ]; then + SYSLOG_ARGS="$SYSLOG_ARGS -b $ROTATEGENS" + fi + LOCAL=0 + elif [ "$D" == "remote" ]; then + SYSLOG_ARGS="$SYSLOG_ARGS -R $REMOTE" + LOG_REMOTE=1 + fi + done + if (( $LOG_LOCAL && $LOG_REMOTE )); then + SYSLOG_ARGS="$SYSLOG_ARGS -L" + fi + if [ -n "$MARKINT" ]; then + SYSLOG_ARGS="$SYSLOG_ARGS -m $MARKINT" + fi + if [ "$REDUCE" == "yes" ]; then + SYSLOG_ARGS="$SYSLOG_ARGS -S" + fi +else + # default: log to 16K shm circular buffer + SYSLOG_ARGS="-C" +fi + +case "$1" in + start) + echo -n "Starting syslogd/klogd: " + start-stop-daemon -S -b -n syslogd -a /sbin/syslogd -- -n $SYSLOG_ARGS + start-stop-daemon -S -b -n klogd -a /sbin/klogd -- -n + echo "done" + ;; + stop) + echo -n "Stopping syslogd/klogd: " + start-stop-daemon -K -n syslogd + start-stop-daemon -K -n klogd + echo "done" + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage: syslog { start | stop | restart }" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/packages/busybox/files/syslog.conf b/packages/busybox/files/syslog.conf new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/busybox/files/syslog.conf |