Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get OpenSIPS working properly. I've got it installed and all is well--except that it won't start at boot because it requires MySQL to run, and for some reason, it is being launched BEFORE MySQLd during init.

What I'd like to do is modify the boot order of my process (/etc/init.d/opensips) so that it is launched AFTER MySQLd, and can work properly.

I've included a pastebin link to my /etc/init.d/opensips file here:

I really have no idea. I've searched google for a while, but can't find any answers that work for me.

Thanks for your time!

share|improve this question

As superuser run:

  1. update-rc.d -f opensips remove
  2. update-rc.d openspips defaults 99
share|improve this answer
Doesn't seem to work, I still have the same issue. Also--opensips was already set at 99. – rdegges Oct 20 '10 at 20:17
Remove opensips from startup. Reboot. Is MySQL running? If yes now run /etc/init.d/opensips start. Does it startup? If yes, then what is the startup number that MySQL is associated with? What are the contents (if any) of /etc/defaults/opensips ? – adamo Oct 20 '10 at 20:31
Ok, I removed both OpenSIPS AND Mysql from startup (no traces of them in /etc/rc*). I rebooted. Mysql is running by default (no idea how?). When I run /etc/init.d/opensips start it starts perfectly and leaves a good log in syslog so I know it connected to mysql. /etc/default/opensips: – rdegges Oct 20 '10 at 20:45
To see where mysql might start from, run "grep -rli mysql /etc/rc*" – adamo Oct 20 '10 at 21:03
It looks like mysql is running via upstart (/etc/init/mysql.conf). Anyway I can force it to run before opensips? – rdegges Oct 20 '10 at 22:05

If you have /etc/init/opensips.conf then change its start on clause to include and started mysql. Or if you have /etc/init.d/opensips then add mysql to its Should-Start: and Should-Stop: clauses.

share|improve this answer
Doesn't work. I have /etc/init.d/opensips, and even if it has mysql in both Should-Start and Should-Stop, it won't work. MySQL is being started via upstart (not initscripts like opensips is), and I think that is the root of the problem. Any other ideas? – rdegges Oct 20 '10 at 22:25

I assume you're running in runlevel 3. Change directory to /etc/rc3.d. You'll see various startup scripts for processes. These scripts are run in order, so you want opensips to have a higher number than mysqld. I.e. if mysql looks like this:


Then you'd want opensips to look like this:


Or some other number higher than 64. Hope that helps!

share|improve this answer
The command update-rc.d can be used to take care of this. No need to do it by hand. – adamo Oct 20 '10 at 19:58
Yep, I just noticed the ubuntu-server tag. I come from a Redhat background :) – Bryan White Oct 20 '10 at 20:01
I actually don't see mysqld in any of the rcX.d folders. But opensips is in all of them (from rc2 -> rc6) as S99opensips. Any other ideas? – rdegges Oct 20 '10 at 20:14
Check Adamo's answer. If you don't have mysql in your rc.d, run 'update-rc.d mysql defaults'. I wonder how mysql was starting in the first place? – Bryan White Oct 20 '10 at 20:22
Since this is Ubuntu, maybe mysql is using Upstart? Look into /etc/init. – Steven Monday Oct 20 '10 at 20:41

If someone is still looking for the answer, they can refer to this link. Manage Linux init or startup scripts, file-rc

It did solve my problem.

share|improve this answer
Welcome to Server Fault! We really do prefer that answers contain content not pointers to content. Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Iain Nov 14 '12 at 13:53

Your Answer


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.