Dean Takemori wrote:
> I'm trying to setup multiple instances of rsyslog (one for kernel
> messages) using lfs-bootscripts-20120116 and running into some
> problems.
> 
> I'm using rsyslogd 5.8.6, which is designed with multiple instance
> support.  I've set up one configuration file (/etc/rsysklog.conf) 
> for the kernel logger and one for the system logger (/etc/rsyslog.conf)
> 
> rsyslogd's 
>       -i flag specifies the pid file used and
>       -f specifies the configuration file.
> 
>> root:~# source /lib/lsb/init-functions
>>
>> root:~# start_daemon -p /run/rsyslogd.pid /sbin/rsyslogd -i 
>> /run/rsyslogd.pid -f /etc/rsyslog.conf
>> root:~# echo $?
>> 0
> 
> Now let's check:
> 
>> root:~# ps xa | grep rsyslogd
>> 8045 ?        Sl   0:00 /sbin/rsyslogd -i /run/rsyslogd/pid -f 
>> /etc/rsyslog.conf
>> 8131 tty1     s+   0:00 grep rsyslog
>>
>> root:~# stausproc -p /run/rsyslogd.pid /rsbin/rsyslogd
>> rsyslogd is running with Process ID(s) 8045
>>
>> root:# cat /run/rsyslogd.pid
>> 8045
> 
> So far so good.
> 
> But now let's try running the second instance.
> 
>> root:~# start_daemon -p /run/rsysklogd.pid /sbin/rsyslogd -i 
>> /run/rsysklogd.pid -f /etc/rsysklog.conf
>> root:~# echo $?
>> 0
> 
> and now check:
>> root:~# ps xa | grep rsyslogd
>>  8045 ?        Sl   0:00 /sbin/rsyslogd -i /run/rsyslogd.pid -f 
>> /etc/rsyslog.conf
>> 8133 tty1     s+   0:00 grep rsyslog
> 
> 
> What?
> 
> Note that rsyslog behaves as expected:
> 
>> root:~# sbin/rsyslogd -i /run/rsysklogd.pid -f /etc/rsysklog.conf
>> root:~# echo $?
>> 0
>>
>> root:~# ps xa | grep rsyslogd
>> 8045 ?        Sl   0:00 /sbin/rsyslogd -i /run/rsyslogd.pid -f 
>> /etc/rsyslog.conf
>> 8149 ?        Sl   0:00 /sbin/rsyslogd -i /run/rsysklogd.pid -f 
>> /etc/rsysklog.conf
>> 8155 tty1     s+   0:00 grep rsyslog
>>
>> root:~# cat /run/rsyslogd.pid
>> 8045
>> root:~# cat /run/rsysklogd.pid
>> 8149
> 
> 
> So far, I think I've tracked the problem down to statusproc() not correctly
> using the pidfile it's given.
> 
> Namely: this is correct
> 
>> root:~# statusproc -p /run/rsyslogd.pid /sbin/rsyslogd
>> rsyslogd is running with Process ID(s) 8045
>>
>> root:~# cat /run/rsyslogd.pid
>> 8045
> 
> But this is not
>> root:~# statusproc -p /run/rsysklogd.pid /sbin/rsyslogd
>> rsyslogd is running with Process ID(s) 8045
>>
>> root:~# cat /run/rsysklogd.pid
>> 8149

statusproc just uses what is returned from pidofproc.  Since you are 
specifying a pidfile, pidofproc is doing:

pidlist=`/bin/head -n1 "${pidfile}"`

It then checks to see if the pids in pidlist are running.
In line 460, we have:

  lpids="${pids}${pid} "

but pids is never defined.  Try changing that line to

  lpids="${lpids}${pid} "

and see if that makes a difference.  If that doesn't help, throw in a 
few echo or cat statements at the right places to see what it going on. 
  If you identify another problem, we'll certainly address it.

> BTW: statusproc() defined in /lib/lsb/init-functions has an "exit 1" just 
> after
> it prints its Usage statement; shouldn't this be a "return 1" instead?

statusproc is a function to print out a nicely formatted status message
from the results of pidofproc. It was designed to be used in an
initialization script as in './script status'  If you give it the wrong
parameters, then that script should start.  If you want to use the info
and do error handling, use pidofproc instead.

> BTW2: statusproc()'s Usage statement says :
>       echo "Usage: [-p pidfile] statusproc {program}"
> Shouldn't this be this?
>       echo "Usage: statusproc [-p pidfile] {program}"

I've fixed this in my sandbox.  It will be updated at the next commit.

   -- Bruce
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to