Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How do I determine whether my services are using runit or init? I use Ubuntu 10.0.4.

Such as nginx, chef, puppet, etc.

share|improve this question
add comment

2 Answers

I'm not completely sure, but since runit uses a supervisor, you should be able to recognize it from looking at the process tree, i.e. from the output of ps faux or, if it's installed, pstree.

You could also just ask runit, i.e. run sv status nginx.

Note however that if all you did was install runit, possibly nothing got switched to use it instead of "plain" init. You can examine /proc/cmdline for an occurrence of init=/sbin/runit-init.

share|improve this answer
add comment

If you need your services to have a common control interface, it may be better to mimic init.d script behavior with sv command. If sv is called as a /etc/init.d/NAME command, it automatically translates this to sv command NAME.

If you run some service (let's say ssh) under runit supervisor, you can do the following:

  1. Rename current init script:

    dpkg-divert --rename /etc/init.d/ssh
    
  2. Create symlink with the same name:

    ln -vs $(which sv) /etc/init.d/ssh
    

Now you can manage your service with familiar commands like this:

/etc/inti.d/ssh status
invoke-rc.d ssh status

Having symlink will cause some complaints about LSB-headers, though. So it's even better not to have symlink, but to create a wrapper script like this:

#!/bin/sh

### BEGIN INIT INFO
# copy these headers from your original script which
    # can be found at /etc/init.d/ssh.distrib
    ### END INIT INFO

exec /usr/bin/chpst -b $0 /usr/bin/sv "$@"

This way you can manage services the same way, whether they're being under runit or not.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.