rsyslog script

Grail Dane grail69 at
Fri Mar 25 07:41:39 UTC 2011

Hey Mathijs
I have been eagerly looking over the cookbook, but it seems to confirm what has already been written below that any attempt to changethe variable value within a script stanza will not be seen in another stanza or outside where this particular exec is.
Using the method of calling the process substitution directly at the exec has fixed the issue of getting the correct value there,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 oneregistered with upstart (shown using initctl list).  So now I cannot reboot or halt system without killing it manually :(
So I am in the process upgrading to 1.0 to see if that will help :)
Date: Fri, 25 Mar 2011 07:07:53 +0100
From: mathijs at
To: upstart-devel at
Subject: Re: rsyslog script


    Message body
    Look at this then, maybe this is the

  > look at chapter 6.2


    On 2011-03-24 17:26, James Hunt wrote:

    On 24/03/11 00:43, Grail Dane wrote:

      > Hi James


      > Thanks very much for the reply :)


      > I had added the full path to exec as well but had not updated
      that when

      > posting (oops)


      > Your solution to remove the variable and use the substitution
      has worked

      > but looks untidy in comparison.

      A simple solution to this *should* be to change your exec stanza
      to a

      script section:



        COMPAT=$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1,

        exec rsyslogd -c$COMPAT

      end script


      However, you then run into that bug I mentioned regarding script

      sections and respawn... :(


      > Is there no real way to pass variables to other parts of the


      > I assume, based on script now working, that the script / end

      > stanzas treat all variables as local hence not available

      > outside.  Is there an option to maybe have a global variable
      for a

      > particular script that could be set inside one stanza and

      > either in another or the exec line as in my example?

      This is just standard Unix semantics. See the very draft:


      > Thanks again for the assist


      > cheers

      > grail


      >> Date: Wed, 23 Mar 2011 09:12:10 +0000

      >> From: james.hunt at

      >> To: upstart-devel at

      >> Subject: Re: rsyslog script


      > On 23/03/11 01:20, Grail Dane wrote:

      >> In case anyone can see room to point me in the right
      direction here, I

      >> have recorded my latest bootup

      >> messages and the one for my rsyslog looks like:


      >> init: rsyslog main process (860) terminated with status 1

      >> init: rsyslog main process ended, respawning


      >> As you can see it seems to respawn but without an
      associated PID yet

      >> running initctl list the corresponding entry is:


      >> rsyslog start/running


      >> Whereas all others with a PID also have - , process PID

      >> And even though it says running, a ps yields nothing and
      no logs are

      >> getting updated.


      >> Any thoughts or help would be appreciated :)

      >> grail



      >> From: grail69 at

      >> To: upstart-devel at

      >> Subject: rsyslog script

      >> Date: Tue, 1 Mar 2011 03:23:15 +0000


      >> I seem to be stuck with this one and not sure if possible
      to do what I

      >> am trying?


      >> I copied the rsyslog.conf from my Ubuntu machine and
      changed it to the

      >> below:


      >> < ---------- start ----------------->

      >> # rsyslog - system logging daemon

      >> #

      >> # rsyslog is an enhanced multi-threaded replacement for
      the traditional

      >> # syslog daemon, logging messages from applications


      >> description"system logging daemon"


      >> start on filesystem

      >> stop on runlevel [06]


      >> expect fork

      >> respawn


      >> pre-start script

      >> COMPAT=$(/sbin/rsyslogd -v | awk 'NR == 1{print
      substr($2, 1, 1)}')

      >> end script


      >> exec rsyslogd -c$COMPAT

      >> < ---------- end ----------------->


      >> This seems to start and assign a PID, it then terminates
      and respawns

      >> but without a PID and consequently is not really running.


      >> So i guess my question is: Am I not able to use variables
      in this way or

      >> have I done it the wrong way?

      >> If yes to the wrong way, would someone please educate me?


      >> Also I am guessing this is not really a devel question
      ... is there a

      >> support list?


      >> Cheers

      >> grail


      >> -- upstart-devel mailing list
      upstart-devel at Modify

      >> settings or unsubscribe at:



      > Hi Grail,


      > The problem with your script is that the "COMPAT" variable is

      > "visible" to the exec stanza: Upstart runs each script
      section in a

      > separate process. Therefore I think that your exec is
      actually running

      > "rsyslogd -c" (which is invalid).


      > As to a solution: you don't actually need that pre-start. You
      could just

      > do this:


      > exec rsyslogd -c$(/sbin/rsyslogd -v | awk 'NR == 1{print
      substr($2, 1,

      >> 1)}')


      > One other comment: you have specified the path to rsyslogd in

      > pre-start, but not in your exec stanza. I appreciate that the

      > .conf file has the same problem, but it is always best to
      specify the

      > path to avoid surprises :)


      > Finally, be careful with respawn and script sections (see



      > Regards,


      > James.



      upstart-devel mailing list

      upstart-devel at

      Modify settings or unsubscribe at:





upstart-devel mailing list
upstart-devel at
Modify settings or unsubscribe at: 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the upstart-devel mailing list