From: Robin Bowes <robin-lists@robinbowes.com>
To: supervision@list.skarnet.org
Subject: Re: Help with chpst -e
Date: Tue, 15 Apr 2008 13:10:09 +0100 [thread overview]
Message-ID: <fu25ue$oee$1@ger.gmane.org> (raw)
In-Reply-To: <20080415042737.GW20279@utopia.intra.guy>
Andras Korn wrote:
> How about
>
> SERVICE_NAME=$(basename $(dirname $(readlink -f .)))
>
> Of course, I don't know how portable readlink is.
I seem to remember reading that readlink is OS-dependent, but it's
shell-agnostic.
>>> Setting LOGUSER to the name of a directory is probably a
>>> copy-paste mistake, I guess? :)
>> No, it's based on the premise that each service is run by a user with the
>> same name. This is over-ridden by the contents of ./env/LOGUSER
>
> Wow. I never considered using usernames with slashes in them, but of course,
> why not?
*blush* - sorry, you were right. It was a mistake. It should of course be:
# Set LOGUSER and LOGDIR to default values if not set in ./env
: ${LOGUSER:=${SERVICE_NAME}}
: ${LOGDIR:=${LOG_PARENT}/${SERVICE_NAME}}
>>>> # Make sure the log dir exists
>>>> if [ ! -e "${LOGDIR}" ]; then
>>>> mkdir -p "${LOGDIR}"
>>>> fi
>>> This fails if LOGDIR exists but is not a directory. (Of course, that
>>> shouldn't happen.)
>> True. I could use -d, but then do I test for $LOGDIR existing but not being
>> a directory? One has to stop somewhere...!
>
> You're right, but at least "cd $LOGDIR || exit 1" fails in a predictable
> way. :)
Yeah, I'll give that some more thought.
>>>> # Set ownership & permissions on the log dir
>>>> chown -R ${LOGUSER} "${LOGDIR}"
>>> This gives ownership of the config file, if it exists, to svlogd. I don't
>>> think that's good.
>> No, it gives ownership of the logdir to the user running the log process so
>> it can write to that dir.
>
> chown -R is recursive, meaning that it will chown the svlogd 'config' file
> which resides in the logdir to the user svlogd will run as.
>
> I agree this only has theoretical significance.
Again, you're correct; I forgot about the config file - I've only just
started using runit (vs. daemontools).
I don't think it's a major issue, but could be fixed by:
chown root "${LOGDIR}"/config
R.
next prev parent reply other threads:[~2008-04-15 12:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-13 23:19 Robin Bowes
2008-04-13 23:52 ` Robin Bowes
2008-04-14 8:34 ` Andras Korn
2008-04-14 8:40 ` Andras Korn
2008-04-14 13:38 ` Robin Bowes
2008-04-14 13:48 ` Andras Korn
2008-04-14 14:16 ` Charlie Brady
2008-04-14 14:31 ` Robin Bowes
2008-04-14 16:41 ` Andras Korn
2008-04-14 21:00 ` Robin Bowes
2008-04-14 21:09 ` Charlie Brady
2008-04-14 21:16 ` Robin Bowes
2008-04-14 22:17 ` Joan Picanyol i Puig
2008-04-14 22:18 ` Andras Korn
2008-04-14 23:05 ` Robin Bowes
2008-04-15 4:27 ` Andras Korn
2008-04-15 12:10 ` Robin Bowes [this message]
2008-04-15 16:31 ` Generic logging run script Robin Bowes
2008-04-15 16:33 ` Help with chpst -e Andras Korn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='fu25ue$oee$1@ger.gmane.org' \
--to=robin-lists@robinbowes.com \
--cc=supervision@list.skarnet.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).