LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 03-13-2011, 07:06 PM   #1
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,008

Rep: Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193
rsyslog upstart script not working as expected


Not sure if this is the correct area to ask this question as it pertains to Upstart but not necessarily to Ubuntu.

Anyhoo, I have made a small alteration (obviously the cause of error ) but not really sure why it does not work. If anyone would point me in the right direction it would be appreciated.

rsyslog.conf:
Code:
# 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
Changes from Ubuntu version, which works, highlighted in red
 
Old 03-15-2011, 10:59 AM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
Code:
COMPAT=$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1, 1)}')
Try /usr/sbin
Code:
COMPAT=$(/usr/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1, 1)}')
 
Old 03-15-2011, 05:36 PM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,008

Original Poster
Rep: Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193
The location is correct on my distribution. I probably should have stated as part of the problem what i am considering as an error

Should I run the following:
Code:
initctl list | grep rsyslog
I get the following output:
Code:
rsyslog start/running
And the other test I have run is:
Code:
pgrep -lf rsyslog
Which yields no return data.

So my issue is that according to initctl the process is running but that both it and pgrep have identified that there is no associated process running.

I can change the variable compat for an absolute number, such as 3, 4 or 5, and a PID is assigned and it is running as expected.

So my main issue seems to be that my variable is not being used or is not getting assigned at the time of use.
 
Old 03-23-2011, 07:47 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,008

Original Poster
Rep: Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193
Apparently script stanzas only incorporate local variables, hence COMPAT is always empty upon execution.
Resolution for the moment is to have the substitution performed inline with the exec call and remove the pre-start script altogether:
Code:
exec /sbin/rsyslogd -c$(/sbin/rsyslogd -v | awk 'NR == 1{print substr($2, 1, 1)}')
 
  


Reply

Tags
upstart



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] >> not working as expected MartenH Linux - Newbie 5 08-22-2010 10:35 AM
UpStart script : create folder - true ; run virtualbox - false. wertum Linux - General 1 08-17-2010 05:57 PM
How i do create autostart script for UpStart ? wertum Programming 2 08-13-2010 11:37 PM
Wireless script not working as expected SlowCoder Linux - General 6 05-24-2008 07:06 AM
Script cd not work as expected cdcshu Linux - Software 1 11-10-2007 04:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 10:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration