Have to restart apache2 after reboot

I’m experiencing some peculiar behavior. After reboot, RT (4.0.13 with
libapache2-mod-perl2 version 2.0.7-3)
can’t connect to database (postgresql 9.1). PG is up and running and I can
connect to it from other clients.
If I restart Apache2, then everything is ok.

From log:
RT: DBI connect(‘dbname=rt4;host=localhost’,‘rt_user’,…) failed: could not
connect to server: Connection refused#012#011Is the server running on host
"localhost" (127.0.0.1) and accepting#012#011TCP/IP connections on port
5432? at /usr/local/share/perl/5.14.2/DBIx/SearchBuilder/Handle.pm line 103.
(/usr/local/share/perl/5.14.2/Carp.pm:102)

Any idea what may be causing this?

View this message in context: http://requesttracker.8502.n7.nabble.com/Have-to-restart-apache2-after-reboot-tp54292.html

I’m experiencing some peculiar behavior. After reboot, RT (4.0.13 with
libapache2-mod-perl2 version 2.0.7-3)
can’t connect to database (postgresql 9.1). PG is up and running and I can
connect to it from other clients.
If I restart Apache2, then everything is ok.

From log:
RT: DBI connect(‘dbname=rt4;host=localhost’,‘rt_user’,…) failed: could not
connect to server: Connection refused#012#011Is the server running on host
"localhost" (127.0.0.1) and accepting#012#011TCP/IP connections on port
5432? at /usr/local/share/perl/5.14.2/DBIx/SearchBuilder/Handle.pm line 103.
(/usr/local/share/perl/5.14.2/Carp.pm:102)

Any idea what may be causing this?

Which init script runs first, Pg or Apache?

-kevin

S18apache2 and S19postgresql.

Changed postgresql to S17, but that didn’t fix it.

View this message in context: http://requesttracker.8502.n7.nabble.com/Have-to-restart-apache2-after-reboot-tp54292p54294.html

S18apache2 and S19postgresql.

Changed postgresql to S17, but that didn’t fix it.

If your OS uses Upstart instead of SysV for Init scrips it isn’t
guarantied that PostgreSQL starts before Apache.

In Debian they solved the problem with an RT Init scrips which defines
the dependencies between the Database and the Webserver:
http://anonscm.debian.org/gitweb/?p=pkg-request-tracker/request-tracker4.git;a=blob_plain;f=debian/request-tracker4.init

Chris

C. Loos wrote

If your OS uses Upstart instead of SysV for Init scrips it isn’t
guarantied that PostgreSQL starts before Apache.

In Debian they solved the problem with an RT Init scrips which defines
the dependencies between the Database and the Webserver:
http://anonscm.debian.org/gitweb/?p=pkg-request-tracker/request-tracker4.git;a=blob_plain;f=debian/request-tracker4.init

I’m on Debian Wheezy (SysVinit).

Thanks for the init-script. It should just run from rc3.d with a lower
number
than database and webserver?

View this message in context: http://requesttracker.8502.n7.nabble.com/Have-to-restart-apache2-after-reboot-tp54292p54309.html

rt4 wrote

C. Loos wrote

If your OS uses Upstart instead of SysV for Init scrips it isn’t
guarantied that PostgreSQL starts before Apache.

In Debian they solved the problem with an RT Init scrips which defines
the dependencies between the Database and the Webserver:
http://anonscm.debian.org/gitweb/?p=pkg-request-tracker/request-tracker4.git;a=blob_plain;f=debian/request-tracker4.init
I’m on Debian Wheezy (SysVinit).

Thanks for the init-script. It should just run from rc3.d with a lower
number
than database and webserver?

Added “# X-Start-Before: apache2” and “# X-Stop-After: apache2” to
/etc/init.d/postgresql, and updated with insserv -r postgresql and insserv
postgresql.

Poblem solved :slight_smile:

View this message in context: http://requesttracker.8502.n7.nabble.com/Have-to-restart-apache2-after-reboot-tp54292p54327.html