From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1702 Path: news.gmane.org!not-for-mail From: Robin Bowes Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Help with chpst -e Date: Mon, 14 Apr 2008 14:38:11 +0100 Message-ID: References: <20080414083428.GK20279@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 1208180355 802 80.91.229.12 (14 Apr 2008 13:39:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Apr 2008 13:39:15 +0000 (UTC) To: supervision@list.skarnet.org Original-X-From: supervision-return-1937-gcsg-supervision=m.gmane.org@list.skarnet.org Mon Apr 14 15:39:42 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 1JlOtW-0006Lt-Uk for gcsg-supervision@gmane.org; Mon, 14 Apr 2008 15:38:51 +0200 Original-Received: (qmail 14648 invoked by uid 76); 14 Apr 2008 13:38:32 -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 14634 invoked from network); 14 Apr 2008 13:38:32 -0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 33 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: <20080414083428.GK20279@utopia.intra.guy> X-Enigmail-Version: 0.95.6 Original-Sender: news Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1702 Archived-At: Andras Korn wrote: > On Mon, Apr 14, 2008 at 12:52:25AM +0100, Robin Bowes wrote: > >> Robin Bowes wrote: >>> Hi, >>> Is it possible to set vars using "chpst -e" and then use those vars later >>> in the same command line? >> Answer: yes it is. >> >> This works: >> >> #!/bin/sh >> exec \ >> chpst -e ./env sh -c ' >> chpst -u ${LOGUSER} \ >> svlogd -tt ${LOGDIR} >> ' >> >> LOGUSER and LOGDIR are set in ./env > > There is also another way, if you don't like the sh -c part: > > #!/bin/sh > if [ "$1" = "have-env" ]; then > exec chpst -u "$LOGUSER" svlogd -tt "$LOGDIR" \ > else > exec chpst -e ./env "$0" have-env > fi Isn't that effectively doing the same thing, but without implicitly invoking "sh -c" ? R.