rsyslog script

Grail Dane grail69 at hotmail.com
Wed May 18 03:24:36 UTC 2011


So I am still battling this one :(
I have looked at the latest Ubuntu version and it has:
script    . /etc/default/rsyslog    exec rsyslogd $RSYSLOGD_OPTIONSend script
And all that is in the default file is - RSYSLOGD_OPTIONS="-c4"
So as this incorporates the option into the variable I tried:
script    COMPAT="-c$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1, 1)}')"    exec /sbin/rsyslogd $COMPATend script
And again this does not work as described below :( At least not in my system yet it works just fine for Ubuntu???
Anyone got a clue for me?
Cheersgrail
From: grail69 at hotmail.com
To: upstart-devel at lists.ubuntu.com
Subject: RE: rsyslog script
Date: Tue, 5 Apr 2011 02:43:42 +0000








Just thought I would give an update that is confusing the hell out of me.
I have upgraded to 1.0 and have found that using the following exec:
exec /sbin/rsyslogd -c$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1, 1)}')
yields me the same error as outline just below.
However, if I change it to simply read:
exec /sbin/rsyslogd -c5
Then all is right with the world and pids are the same when reported from either status or pgrep and my systemcan halt or reboot without having the wrong pid killed or hanging on.
Is someone able to explain to me why this is happening? (btw. the process substitution returns the number 5)
cheersgrail

From: grail69 at hotmail.com
To: upstart-devel at lists.ubuntu.com
Subject: RE: rsyslog script
Date: Fri, 25 Mar 2011 07:41:39 +0000








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 :)
cheersgrail
Date: Fri, 25 Mar 2011 07:07:53 +0100
From: mathijs at smoeltje.nl
To: upstart-devel at lists.ubuntu.com
Subject: Re: rsyslog script



  


    
    Message body
  
  
    Look at this then, maybe this is the
      solution?

    
    

    http://upstart.ubuntu.com/cookbook/  > 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:

      

      script

        COMPAT=$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1,
      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
      script?

      

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

      > 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
      used

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

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

      

http://people.canonical.com/~jhunt/upstart/cookbook/#environment-variables

      

      > Thanks again for the assist

      

      > cheers

      > grail

      

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

      >> From: james.hunt at canonical.com

      >> To: upstart-devel at lists.ubuntu.com

      >> 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 hotmail.com

      >> To: upstart-devel at lists.ubuntu.com

      >> 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 lists.ubuntu.com Modify

      >> settings or unsubscribe at:

      >> https://lists.ubuntu.com/mailman/listinfo/upstart-devel

      

      > Hi Grail,

      

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

      > "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
      your

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

      > .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

      > https://bugs.launchpad.net/upstart/+bug/406397).

      

      > Regards,

      

      > James.

      >>

      --

      upstart-devel mailing list

      upstart-devel at lists.ubuntu.com

      Modify settings or unsubscribe at:

      > https://lists.ubuntu.com/mailman/listinfo/upstart-devel

      

    
    

  


-- 
upstart-devel mailing list
upstart-devel at lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel 		 	   		  

-- 
upstart-devel mailing list
upstart-devel at lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel 		 	   		  

-- 
upstart-devel mailing list
upstart-devel at lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20110518/6d59d774/attachment-0001.html>


More information about the upstart-devel mailing list