@ -0,0 +1,42 @@ |
|||||
|
#!/bin/sh |
||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: target/mnemosyne/overlay.d/pkgs/runit/etc_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 |
||||
|
. /etc/runit/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/ |
@ -0,0 +1,55 @@ |
|||||
|
# vim: set ft=sh: |
||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: target/mnemosyne/overlay.d/pkgs/runit/etc_runit_runit-run.in.txt |
||||
|
# 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 --- |
||||
|
|
||||
|
usage() { |
||||
|
cat <<EOT >&2 |
||||
|
usage: $0 <run_script> |
||||
|
ln -s $0 <run_script>; <run_script> |
||||
|
EOT |
||||
|
exit 1 |
||||
|
} |
||||
|
|
||||
|
progname() { |
||||
|
case "$1" in |
||||
|
/*) echo "$1" ;; |
||||
|
*/*) echo "$(cd "${1%/*}"; pwd)/${1##*/}" ;; |
||||
|
*) if [ "$PWD" = / ]; then |
||||
|
echo "/$0" |
||||
|
else |
||||
|
echo "$PWD/$0" |
||||
|
fi ;; |
||||
|
esac |
||||
|
} |
||||
|
|
||||
|
PROGNAME="$(progname "$0")" |
||||
|
if [ "$PROGNAME" != "/etc/runit/${TEMPLATE:-runit-run}" ]; then |
||||
|
# symlinked |
||||
|
SCRIPT= |
||||
|
elif [ $# -gt 0 ]; then |
||||
|
# Sha-Bang'ed |
||||
|
PROGNAME="$1"; shift |
||||
|
SCRIPT=yes |
||||
|
else |
||||
|
usage |
||||
|
fi |
||||
|
|
||||
|
if [ -s "$PROGNAME" ] && ${SHELL:-sh} -n "$PROGNAME"; then |
||||
|
PROGNAME="$(progname "$PROGNAME")" |
||||
|
else |
||||
|
echo "$PROGNAME: invalid script" >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
cd "${PROGNAME%/*}" |
@ -0,0 +1,34 @@ |
|||||
|
#!/bin/sh |
||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: target/mnemosyne/overlay.d/pkgs/runit/etc_runit_runit-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 --- |
||||
|
# |
||||
|
# to be used as symlink to /etc/runit/runit-run or #!/etc/runit/runit-run |
||||
|
|
||||
|
exec 2>&1 |
||||
|
|
||||
|
. /etc/runit/runit-run.in |
||||
|
|
||||
|
set -e |
||||
|
|
||||
|
SVID="${PWD##*/}" |
||||
|
RUN= |
||||
|
|
||||
|
[ -z "$SCRIPT" ] || . "$PROGNAME" |
||||
|
|
||||
|
if [ -n "$RUN" ]; then |
||||
|
exec "$RUN" |
||||
|
else |
||||
|
echo "$PROGNAME: no daemon to RUN defined" >&2 |
||||
|
exit 1 |
||||
|
fi |