archcutbank
archcutbank

Reputation: 479

redhat linux upstart (initctl) issue on reboot

Morning,

I have monit I am testing on redhat 6.4 system. I setup a /etc/init/monit.conf:

description "Monit service manager"

limit core unlimited unlimited

start on runlevel [2345]

stop on runlevel [!2345]

expect daemon

respawn

exec /local/mis/monit/bin/monit -c /local/mis/monit/etc/monitrc

pre-stop exec /local/mis/monit/bin/monit -c /local/mis/monit/etc/monitrc quit

At the command line as root I can run stop monit and start monit just fine and it shows pid number. However, during reboot, it does not start. It shows start/running with no pid if I run initctl list, but if you check with ps -ef monit is not running. I can run stop monit and then run start monit just fine after a reboot. I am at a lose with how to troubleshoot. My system has /var/log/messages, but no /var/log/syslog. I see options to use log-priority info, but I am not sure how to set that as the level for logging during the reboot. The /var/log/message does not mention monit and /var/log/boot.log does not either. dmesg shows nothing.

Upvotes: 0

Views: 1410

Answers (2)

archcutbank
archcutbank

Reputation: 479

The final solution I ended up using: description "Monit service manager"

start on (net-device-up IFACE=eth0 and started networking and runlevel [2345]) stop on runlevel [!2345] limit core unlimited unlimited

expect daemon respawn

Had to do a pre-start script to loop until successful with nslookup of mail server listed in the monitrc file.

pre-start script while [ 0 ]; do i=/usr/bin/nslookup outlookwebapp.na.sas.com | grep Name if [ ! -z "$i" ]; then break fi sleep 4 done end script

exec /local/mis/monit/bin/monit -c /local/mis/monit/etc/monitrc

pre-stop exec /local/mis/monit/bin/monit -c /local/mis/monit/etc/monitrc quit

Upvotes: 0

randy
randy

Reputation: 1877

this sounds like the same problem we just fixed. We run monit as user "monit". upstart was trying to start it as root and the monit files where owned my user "monit". And we were getting identical symptoms you were getting.

To fix it i altered /etc/init/monit to

exec su -c "/web/bin/monit -c /web/etc/monitrc" monit

now when i start monitI see::

# start monit
monit start/running, process 3421

Upvotes: 0

Related Questions