2

I have the following script in my rc.local:

This runs the services on ports 8080, 8081, 8082, 8083. They are actually node servers that NEED mongod to startup.

So, I edited /lib/systemd/system/rc-local.service and added:

After=network.target syslog.target mongod.service

But no: the scripts still fail because, at running time, they find that the database server is down.

What could I be doing wrong? How would I debug this?

UPDATE: Now that I added After=, the error is not the mongoDb connection (I was looking at old logs), but rather the fact that rc-local doesn't seem to be starting at all. Running manually systemctl restart rc-local.service works though...

UPDATE 2: By taking syslog.target out, and so having:

After=network.target mongod.service

has the strange side effect that HALF of the servers (2 out of 4) start fine, and the other HALF fail to connect to the database. This makes me think that systemd runs mongodb, but it's not yet ready to take connections when rc-local is run

Merc
  • 719
  • 1
  • 6
  • 16

1 Answers1

-2

As a workaround, why don't you set mongodb not to start using systemctl and set it to start in rclocal before the items you need?

CD Brian
  • 67
  • 5