<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
So I am still battling this one :(<div><br></div><div>I have looked at the latest Ubuntu version and it has:</div><div><br></div><div><div>script</div><div> . /etc/default/rsyslog</div><div> exec rsyslogd $RSYSLOGD_OPTIONS</div><div>end script</div><div><br></div>And all that is in the default file is - RSYSLOGD_OPTIONS="-c4"</div><div><br></div><div>So as this incorporates the option into the variable I tried:</div><div><br></div><div>script</div><div> COMPAT="-c$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1, 1)}')"</div><div> exec /sbin/rsyslogd $COMPAT</div><div>end script</div><div><br></div><div>And again this does not work as described below :( At least not in my system yet it works just fine for Ubuntu???</div><div><br></div><div>Anyone got a clue for me?</div><div><br></div><div>Cheers</div><div>grail<br><hr id="stopSpelling">From: grail69@hotmail.com<br>To: upstart-devel@lists.ubuntu.com<br>Subject: RE: rsyslog script<br>Date: Tue, 5 Apr 2011 02:43:42 +0000<br><br>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
Just thought I would give an update that is confusing the hell out of me.<div><br></div><div>I have upgraded to 1.0 and have found that using the following exec:</div><div><br></div><div>exec /sbin/rsyslogd -c$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1, 1)}')</div><div><br></div><div>yields me the same error as outline just below.</div><div><br></div><div>However, if I change it to simply read:</div><div><br></div><div>exec /sbin/rsyslogd -c5</div><div><br></div><div>Then all is right with the world and pids are the same when reported from either status or pgrep and my system</div><div>can halt or reboot without having the wrong pid killed or hanging on.</div><div><br></div><div>Is someone able to explain to me why this is happening? (btw. the process substitution returns the number 5)</div><div><br></div><div>cheers</div><div>grail<br><br><hr id="ecxstopSpelling">From: grail69@hotmail.com<br>To: upstart-devel@lists.ubuntu.com<br>Subject: RE: rsyslog script<br>Date: Fri, 25 Mar 2011 07:41:39 +0000<br><br>
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
Hey Mathijs<div><br></div><div>I have been eagerly looking over the cookbook, but it seems to confirm what has already been written below that any attempt to change</div><div>the variable value within a script stanza will not be seen in another stanza or outside where this particular exec is.</div><div><br></div><div>Using the method of calling the process substitution directly at the exec has fixed the issue of getting the correct value there,</div><div>but now as outlined by James i have hit the bug #406397 where the PID being used by the system (shown with a pgrep) is not the one</div><div>registered with upstart (shown using initctl list). So now I cannot reboot or halt system without killing it manually :(</div><div><br></div><div>So I am in the process upgrading to 1.0 to see if that will help :)</div><div><br></div><div>cheers</div><div>grail</div><div><br><hr id="ecxstopSpelling">Date: Fri, 25 Mar 2011 07:07:53 +0100<br>From: mathijs@smoeltje.nl<br>To: upstart-devel@lists.ubuntu.com<br>Subject: Re: rsyslog script<br><br>
<title>Message body</title>
<div style="display:inline">Look at this then, maybe this is the
solution?<br>
</div>
<br>
<a class="ecxmoz-txt-link-freetext" href="http://upstart.ubuntu.com/cookbook/" target="_blank">http://upstart.ubuntu.com/cookbook/</a> > look at chapter 6.2<br>
<br>
On 2011-03-24 17:26, James Hunt wrote:<br>
<blockquote>On 24/03/11 00:43, Grail Dane wrote:<br>
> 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<br>
> posting (oops)<br>
<br>
> Your solution to remove the variable and use the substitution
has worked<br>
> but looks untidy in comparison.<br>
A simple solution to this *should* be to change your exec stanza
to a<br>
script section:<br>
<br>
script<br>
COMPAT=$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1,
1)}')<br>
exec rsyslogd -c$COMPAT<br>
end script<br>
<br>
However, you then run into that bug I mentioned regarding script<br>
sections and respawn... :(<br>
<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<br>
> stanzas treat all variables as local hence not available<br>
> outside. Is there an option to maybe have a global variable
for a<br>
> particular script that could be set inside one stanza and
used<br>
> either in another or the exec line as in my example?<br>
This is just standard Unix semantics. See the very draft:<br>
<br>
<a class="ecxmoz-txt-link-freetext" href="http://people.canonical.com/~jhunt/upstart/cookbook/#environment-variables" target="_blank">http://people.canonical.com/~jhunt/upstart/cookbook/#environment-variables</a><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="ecxmoz-txt-link-abbreviated" href="mailto:james.hunt@canonical.com">james.hunt@canonical.com</a><br>
>> To: <a class="ecxmoz-txt-link-abbreviated" href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a><br>
>> Subject: Re: rsyslog script<br>
>><br>
> 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="ecxmoz-txt-link-abbreviated" href="mailto:grail69@hotmail.com">grail69@hotmail.com</a><br>
>> To: <a class="ecxmoz-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="ecxmoz-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="ecxmoz-txt-link-freetext" href="https://lists.ubuntu.com/mailman/listinfo/upstart-devel" target="_blank">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,<br>
>> 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="ecxmoz-txt-link-freetext" href="https://bugs.launchpad.net/upstart/+bug/406397" target="_blank">https://bugs.launchpad.net/upstart/+bug/406397</a>).<br>
<br>
> Regards,<br>
<br>
> James.<br>
>><br>
--<br>
upstart-devel mailing list<br>
<a class="ecxmoz-txt-link-abbreviated" href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at:<br>
> <a class="ecxmoz-txt-link-freetext" href="https://lists.ubuntu.com/mailman/listinfo/upstart-devel" target="_blank">https://lists.ubuntu.com/mailman/listinfo/upstart-devel</a><br>
<br>
</blockquote>
<br>
<br>--
upstart-devel mailing list
upstart-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel</div>
<br>--
upstart-devel mailing list
upstart-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel</div>
<br>--
upstart-devel mailing list
upstart-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel</div> </body>
</html>