You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
#!/bin/sh |
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# Filename: package/.../runit/overlay.d/runit/D%sbindir_runit-log-run.sh |
|
# Copyright (C) 2010 The OpenSDE Project |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# This program is free software; you can redistribute it and/or modify |
|
# it under the terms of the GNU General Public License as published by |
|
# the Free Software Foundation; version 2 of the License. A copy of the |
|
# GNU General Public License can be found in the file COPYING. |
|
# --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
TEMPLATE=log-run |
|
. D_libdir/runit-run.in |
|
|
|
set -e |
|
|
|
# Variables to override |
|
# |
|
SVID="$(pwd | sed -ne 's|.*/\([^/]\+\)/log$|\1|p')" |
|
LOGUSER=log |
|
LOGDIR="${SVID:+/var/log/$SVID}" |
|
|
|
SVLOGD_OPT=-t |
|
|
|
[ -z "$SCRIPT" ] || . "$PROGNAME" |
|
|
|
# Detect SVID if needed |
|
[ -n "$SVID" ] || die "$PWD: invalid log/run dir" |
|
|
|
# Detect LOGDIR if needed |
|
[ -n "$LOGDIR" ] || LOGDIR="/var/log/$SVID" |
|
[ -d "$LOGDIR/" ] || mkdir -p "$LOGDIR" |
|
chown "${LOGUSER:-log}" "$LOGDIR" |
|
|
|
# ./main -> $LOGDIR |
|
[ -d "main/" ] || ln -s "$LOGDIR" "main" |
|
|
|
exec setuidgid "${LOGUSER:-log}" svlogd ${SVLOGD_OPT} main/
|
|
|