blob: ee68ad12b017e7158e20ae239a88de927638e50c [file] [log] [blame]
Denys Vlasenko14339192018-07-03 23:23:09 +02001#!/bin/sh
2
3user=logger
4
5exec >/dev/null 2>&1
6
7service="${PWD%/log}"
8service="${service##*/}"
9logdir="/var/log/service/$service"
10
11mkdir -p "$logdir"
12chown -R "$user": "$logdir"
13chmod -R go-rwxst,u+rwX "$logdir"
14# TODO: if "$logdir/config" does not exist,
15# based on service's preferences, write some setup in it:
16# e.g. smaller nNUM directive ("I'm not that important,
17# save 2 rather than default 10 one-megabyte log files")
18
19# Convenience symlink in this log/ directory:
20rm logdir
21ln -s "$logdir" logdir
22
23# Make current dir accessible to logger:
24chmod a+rX .
25
26args=""
27test "$LOG_NOTIMESTAMP" || args="-tt"
28
29exec \
30env - PATH="$PATH" \
31chpst -u "$user" -m $((20 * 1024*1024)) \
32svlogd $args "$logdir"