small medium large xlarge

Generic-user-small
14 Aug 2008, 07:11
Ramon Miguel M. Tayag (2 posts)

I’ve been trying for the past 3 days to get the /etc/inittab thingie to work, as mentioned in the book.

I’m trying to get init to automatically start monit. “sudo telinit q” doesn’t seem to work, or maybe my “/etc/inittab”:http://pastie.org/252629 is just wrong. When I run the first line (/usr/local/bin/monit -Ic /etc/monitrc) though with “sudo” at the beginning, monit starts.

I’m using Ubuntu Hardy Heron, so I started asking around, and I learned that 2 things: 1) Ubuntu’s init is event-driven 2) Ubuntu runs at level 2

Whatever that may mean (I’m a bit of a newbie), in the different places I’ve asked, they said that I should use “upstart”:http://upstart.ubuntu.com/, which is a bit unfortunate, because this init problem seems too a simple problem to learn a whole new way of doing things.

I wanted to share this though, and I’ll paste my updates so you guys can do the same if you’re having the same problem.

Generic-user-small
14 Aug 2008, 14:47
Ramon Miguel M. Tayag (2 posts)

Okay, I can’t say I understand everything about the runlevels and such, but it works! I killed monit and it restarted. I rebooted the system and it started monit on its own. Here’s the upstart script that I made (at least in Ubuntu Hardy, upstart was already installed):

sudo vi /etc/event.d/service_monit

Then paste (do a “which monit” to find out where monit is and replace the /usr/local/bin/monit if needed):

description     "service monit"
author          "Ramon Tayag <ramon.tayag@.com>"

start on startup
stop on runlevel 0
stop on runlevel 1
stop on runlevel 3
stop on runlevel 6

console output

exec /usr/local/bin/monit -Ic /etc/monitrc
respawn

I also used the same type of script, saved it in the same place, to automatically start nginx. :)

You must be logged in to comment