A script that runs just fine normally fails when put into an /etc/init.d/ script (consolenew), to activate at bootup.
Specifically, it cannot open the PostgreSQL database, giving the error: could not connect to server: Connection refused
init.d/consolenew settings:
#### BEGIN INIT INFO
# Provides: consolenew
# Required-Start: $all $postgresql $network
# Required-Stop: $all $postgresql $network
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: ....
#### END INIT INFO
/path-to-file/consolenew.sh &
System is Debian 8. What is missing here to get PostgreSQL to work?