From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1713 Path: news.gmane.org!not-for-mail From: Andras Korn Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Help with chpst -e Date: Tue, 15 Apr 2008 06:27:38 +0200 Message-ID: <20080415042737.GW20279@utopia.intra.guy> References: <20080414083428.GK20279@utopia.intra.guy> <20080414164126.GP20279@utopia.intra.guy> <20080414221821.GV20279@utopia.intra.guy> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 X-Trace: ger.gmane.org 1208233735 24801 80.91.229.12 (15 Apr 2008 04:28:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Apr 2008 04:28:55 +0000 (UTC) To: supervision@list.skarnet.org Original-X-From: supervision-return-1948-gcsg-supervision=m.gmane.org@list.skarnet.org Tue Apr 15 06:29:30 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 1JlcnS-0004yF-Ic for gcsg-supervision@gmane.org; Tue, 15 Apr 2008 06:29:30 +0200 Original-Received: (qmail 12297 invoked by uid 76); 15 Apr 2008 04:29:11 -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 12292 invoked from network); 15 Apr 2008 04:29:11 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.16 (2007-06-11) Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1713 Archived-At: On Tue, Apr 15, 2008 at 12:05:02AM +0100, Robin Bowes wrote: >>> # Get the service name >>> logdir=`pwd` >>> svcdir=${logdir%/log} >>> SERVICE_NAME=${svcdir##*/} >> Isn't this a bashism? > > Yes. I welcome suggestions how to do this in a more portable way. How about SERVICE_NAME=$(basename $(dirname $(readlink -f .))) Of course, I don't know how portable readlink is. >> 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? >>> # 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. :) >>> # 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. Andras -- Andras Korn QOTD: Smile... people will wonder what you've been up to.