1821985 Members
3365 Online
109638 Solutions
New Discussion юеВ

respawn of syslogd

 
SOLVED
Go to solution
YLTan
Frequent Advisor

respawn of syslogd

I need to respawn the syslogd daemon when it is killed, I have tried 3 diff. entries in the /etc/inittab but in each case when the syslog daemon is killed, 37 new syslogd got spawn up. Why??

When I run "init q" with syslogd still active it spawn up 7 of syslogd daemon. Why??

I also notice that the respawning is not immediate. How do i make it immediate so as not to lose the system logging capabilities.

Here are the entries I have tried on the inittab file;

sylg::respawn:/usr/sbin/syslogd -D
sylg:3:respawn:/usr/sbin/syslogd -D
sylg:123456:respawn:/usr/sbin/syslogd -D

How do i make it such that it only spawn up one syslogd daemon if the previous one got killed?
tyl
8 REPLIES 8
Michael Tully
Honored Contributor

Re: respawn of syslogd

I don't understand why your using the syslog daemon in this manner. It should be started and stopped using /sbin/rc?.d start/stop scripts.

There is a startup/shutdown script as part of the system start/stop procedures.

This how I would fix it.

# vi /etc/inittab
edit the entries and place a comment for each one with a '#'
Save the file
# init q

# ps -ef | grep syslogd | awk '{print $2}' | xargs kill -5
# /sbin/init.d/syslogd start

There are better ways to monitor daemons with scripts and also third party products.
Anyone for a Mutiny ?
Dietmar Konermann
Honored Contributor
Solution

Re: respawn of syslogd

Hi!

I tend to agree with Michael... syslogd is not intended to be run from inittab.

However, your problem is, that by default syslogd runs as daemon, which means, it detaches and fork()s itself to the background. Due to this init(1M) has problems to track if it's running. :)

This may be a workaround: run syslogd in debug mode and redirect its output to /dev/null. Not really nice. BTW, I would only specifiy run levels 2-4.

sylg:34:respawn:/usr/sbin/syslogd -D -d >/dev/null 2>&1

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
YLTan
Frequent Advisor

Re: respawn of syslogd

Hi Michael,

Because one of my MC/Service guard dismount the shared disk where the syslogd is writing to it which killed off syslogd.
tyl
YLTan
Frequent Advisor

Re: respawn of syslogd

Hi Dietmar,

I tried your method but i got this msg in the syslog.log file, what does it means by kernel messages are disable?? how to enable it??

Mar 11 03:06:55 prx03 syslogd: the kernel messages are already disabled: Not a typewriter
tyl
Dietmar Konermann
Honored Contributor

Re: respawn of syslogd

This usually happens if the old syslogd was killed with -9 (SIGKILL) and a new syslogd is started with -D option. But nevertheless, syslogd should work as exspected. You can ignore the message.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
YLTan
Frequent Advisor

Re: respawn of syslogd

Hi Dietmar,

I also got some message at the console saying about ...Address is already bind for /dev/log.un....

Is this refer to the same reason you mention??
tyl
Dietmar Konermann
Honored Contributor

Re: respawn of syslogd

Maybe... but it could also be possible that more that one syslogd is currently running? Kill all and watch what happens:

# kill $(UNIX95= ps -opid= -Csyslogd)

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
YLTan
Frequent Advisor

Re: respawn of syslogd

Hi Dietmar,

Thanks for the help, you solve my headache. :)

Hi Micheal,

Thanks for the tips also, appreciate it.

regards
YLTAN
tyl