# Control services startup order



## mururoa (Mar 4, 2015)

Hello,
I just installed a Java application using PosgreSQL and Tomcat 7.
So far so good but when the server start, Tomcat is started before PostgreSQL is fully initialized and the application fail to start. So I have to log and do

`service tomcat7 restart`

In rc.conf I have the correct order. PosgreSQl before and then Tomcat.
I'll tried to put some delay in the Tomcat startup script


```
eval "_tomcat_wait=\${${name}_wait:-'90'}"
```
 without luck so far.
I looked to force_depend but it seems hard to use and I'm not sure it will solve the problem.
Which simple solution did I missed ?

PS : I don't see PostgreSQL start in console.log but it started ok when I log and test the status.


----------



## mururoa (Mar 4, 2015)

Found it 
I was just starting to wonder how come something easy to do on Linux was hard to do on FreeBSD 
But it's simple.
Just have to add

```
# BEFORE: tomcat7
```
in the PostgreSQL startup script header and it's ok.

Then `rcorder /etc/rc.d/* /usr/local/etc/rc.d/* | egrep 'tomcat|postgres'` shows:

```
/usr/local/etc/rc.d/postgresql
/usr/local/etc/rc.d/tomcat7
```


----------

