diff options
author | Denys Vlasenko | 2018-07-03 23:23:09 +0200 |
---|---|---|
committer | Denys Vlasenko | 2018-07-03 23:23:09 +0200 |
commit | 14339191afc5d77205487e3365ca2569f86afd44 (patch) | |
tree | 95fdd8f36e2dcf61126bbbdfe55c735562bcac7e /examples/var_service/std_service_logger | |
parent | aa75a7da7f3b0bb50be82f535244137bae423fa8 (diff) | |
download | busybox-14339191afc5d77205487e3365ca2569f86afd44.zip busybox-14339191afc5d77205487e3365ca2569f86afd44.tar.gz |
examples/var_service/: use standard logger script, viewer and pager scripts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'examples/var_service/std_service_logger')
-rwxr-xr-x | examples/var_service/std_service_logger | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/var_service/std_service_logger b/examples/var_service/std_service_logger new file mode 100755 index 0000000..ee68ad1 --- /dev/null +++ b/examples/var_service/std_service_logger @@ -0,0 +1,32 @@ +#!/bin/sh + +user=logger + +exec >/dev/null 2>&1 + +service="${PWD%/log}" +service="${service##*/}" +logdir="/var/log/service/$service" + +mkdir -p "$logdir" +chown -R "$user": "$logdir" +chmod -R go-rwxst,u+rwX "$logdir" +# TODO: if "$logdir/config" does not exist, +# based on service's preferences, write some setup in it: +# e.g. smaller nNUM directive ("I'm not that important, +# save 2 rather than default 10 one-megabyte log files") + +# Convenience symlink in this log/ directory: +rm logdir +ln -s "$logdir" logdir + +# Make current dir accessible to logger: +chmod a+rX . + +args="" +test "$LOG_NOTIMESTAMP" || args="-tt" + +exec \ +env - PATH="$PATH" \ +chpst -u "$user" -m $((20 * 1024*1024)) \ +svlogd $args "$logdir" |