rsyslog script
James Hunt
james.hunt at canonical.com
Wed Mar 23 09:12:10 UTC 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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.
- --
James Hunt
____________________________________
Ubuntu Foundations Team, Canonical.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk2JuWYACgkQYBWEaHcQG9eJggCghk1CNnnMRv7jH4D9L1C8A7CH
mKsAn2Zx50abeR4yWqwMT2Bx5mHdMdTY
=8U0r
-----END PGP SIGNATURE-----
More information about the upstart-devel
mailing list