<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
Im not sure if this will work, but did you try something like this?<br>
<br>
pre-start script<br>
COMPAT=$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1,
1)}')<br>
export COMPAT<br>
end script
<div style="display: inline;"> </div>
<br>
<br>
??<br>
<br>
On 2011-03-24 01:43, Grail Dane wrote:<br>
<span style="white-space: pre;">> Hi James<br>
><br>
> Thanks very much for the reply :)<br>
><br>
> I had added the full path to exec as well but had not updated
that when posting (oops)<br>
><br>
> Your solution to remove the variable and use the substitution
has worked but looks untidy in comparison.<br>
> Is there no real way to pass variables to other parts of the
script?<br>
><br>
> I assume, based on script now working, that the script / end
script stanzas treat all variables as local hence not available<br>
> outside. Is there an option to maybe have a global variable
for a particular script that could be set inside one stanza and
used<br>
> either in another or the exec line as in my example?<br>
><br>
> Thanks again for the assist<br>
><br>
> cheers<br>
> grail<br>
><br>
> > Date: Wed, 23 Mar 2011 09:12:10 +0000<br>
> > From: <a class="moz-txt-link-abbreviated" href="mailto:james.hunt@canonical.com">james.hunt@canonical.com</a><br>
> > To: <a class="moz-txt-link-abbreviated" href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a><br>
> > Subject: Re: rsyslog script<br>
> ></span><br>
<blockquote type="cite">On 23/03/11 01:20, Grail Dane wrote:<br>
> In case anyone can see room to point me in the right
direction here, I<br>
> have recorded my latest bootup<br>
> messages and the one for my rsyslog looks like:<br>
<br>
> init: rsyslog main process (860) terminated with status 1<br>
> init: rsyslog main process ended, respawning<br>
<br>
> As you can see it seems to respawn but without an associated
PID yet<br>
> running initctl list the corresponding entry is:<br>
<br>
> rsyslog start/running<br>
<br>
> Whereas all others with a PID also have - , process PID<br>
> And even though it says running, a ps yields nothing and no
logs are<br>
> getting updated.<br>
<br>
> Any thoughts or help would be appreciated :)<br>
> grail<br>
<br>
>
------------------------------------------------------------------------<br>
> From: <a class="moz-txt-link-abbreviated" href="mailto:grail69@hotmail.com">grail69@hotmail.com</a><br>
> To: <a class="moz-txt-link-abbreviated" href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a><br>
> Subject: rsyslog script<br>
> Date: Tue, 1 Mar 2011 03:23:15 +0000<br>
<br>
> I seem to be stuck with this one and not sure if possible to
do what I<br>
> am trying?<br>
<br>
> I copied the rsyslog.conf from my Ubuntu machine and changed
it to the<br>
> below:<br>
<br>
> < ---------- start -----------------><br>
> # rsyslog - system logging daemon<br>
> #<br>
> # rsyslog is an enhanced multi-threaded replacement for the
traditional<br>
> # syslog daemon, logging messages from applications<br>
<br>
> description"system logging daemon"<br>
<br>
> start on filesystem<br>
> stop on runlevel [06]<br>
<br>
> expect fork<br>
> respawn<br>
<br>
> pre-start script<br>
> COMPAT=$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1,
1)}')<br>
> end script<br>
<br>
> exec rsyslogd -c$COMPAT<br>
> < ---------- end -----------------><br>
<br>
> This seems to start and assign a PID, it then terminates and
respawns<br>
> but without a PID and consequently is not really running.<br>
<br>
> So i guess my question is: Am I not able to use variables in
this way or<br>
> have I done it the wrong way?<br>
> If yes to the wrong way, would someone please educate me?<br>
<br>
> Also I am guessing this is not really a devel question ... is
there a<br>
> support list?<br>
<br>
> Cheers<br>
> grail<br>
<br>
> -- upstart-devel mailing list <a class="moz-txt-link-abbreviated" href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a>
Modify<br>
> settings or unsubscribe at:<br>
> <a class="moz-txt-link-freetext" href="https://lists.ubuntu.com/mailman/listinfo/upstart-devel">https://lists.ubuntu.com/mailman/listinfo/upstart-devel</a><br>
<br>
Hi Grail,<br>
<br>
The problem with your script is that the "COMPAT" variable is not<br>
"visible" to the exec stanza: Upstart runs each script section in
a<br>
separate process. Therefore I think that your exec is actually
running<br>
"rsyslogd -c" (which is invalid).<br>
<br>
As to a solution: you don't actually need that pre-start. You
could just<br>
do this:<br>
<br>
exec rsyslogd -c$(/sbin/rsyslogd -v | awk 'NR == 1{print
substr($2, 1, 1)}')<br>
<br>
One other comment: you have specified the path to rsyslogd in your<br>
pre-start, but not in your exec stanza. I appreciate that the
original<br>
.conf file has the same problem, but it is always best to specify
the<br>
path to avoid surprises :)<br>
<br>
Finally, be careful with respawn and script sections (see<br>
<a class="moz-txt-link-freetext" href="https://bugs.launchpad.net/upstart/+bug/406397">https://bugs.launchpad.net/upstart/+bug/406397</a>).<br>
<br>
Regards,<br>
<br>
James.<br>
</blockquote>
<span style="white-space: pre;">> ></span><br>
--<br>
upstart-devel mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at:
<a class="moz-txt-link-freetext" href="https://lists.ubuntu.com/mailman/listinfo/upstart-devel">https://lists.ubuntu.com/mailman/listinfo/upstart-devel</a><br>
<br>
<br>
</body>
</html>