From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1714 Path: news.gmane.org!not-for-mail From: Robin Bowes Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Help with chpst -e Date: Tue, 15 Apr 2008 13:10:09 +0100 Message-ID: References: <20080414083428.GK20279@utopia.intra.guy> <20080414164126.GP20279@utopia.intra.guy> <20080414221821.GV20279@utopia.intra.guy> <20080415042737.GW20279@utopia.intra.guy> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1208261415 25154 80.91.229.12 (15 Apr 2008 12:10:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Apr 2008 12:10:15 +0000 (UTC) To: supervision@list.skarnet.org Original-X-From: supervision-return-1949-gcsg-supervision=m.gmane.org@list.skarnet.org Tue Apr 15 14:10:44 2008 connect(): Connection refused Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by lo.gmane.org with smtp (Exim 4.50) id 1Jljzk-0006oh-8T for gcsg-supervision@gmane.org; Tue, 15 Apr 2008 14:10:40 +0200 Original-Received: (qmail 18018 invoked by uid 76); 15 Apr 2008 12:10:21 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 18009 invoked from network); 15 Apr 2008 12:10:21 -0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 59 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 84-51-160-74.pambow882.adsl.metronet.co.uk User-Agent: Thunderbird 2.0.0.12 (X11/20080226) In-Reply-To: <20080415042737.GW20279@utopia.intra.guy> X-Enigmail-Version: 0.95.6 Original-Sender: news Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1714 Archived-At: 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.