I have a init.d script which launches one program, startconsole.sh . This shell script works perfectly fine when launched from the command line; it does have a lot of dependencies however – network connections, postgresql, etc.
The error appears to be the system terminates the program before it can finish, specifically in the PostgreSQL section:
FATAL: terminating connection due to administrator command
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
How can I ensure this program runs entirely, and is not interrupted mid-execution by the log-in screen or whatever else may be interrupting?
System: Debian 8
init.d code:
#! /bin/sh
# /etc/init.d/console
### BEGIN INIT INFO
# Provides: console
# Required-Start: $all
# Required-Stop: $local_fs $network $remote_fs $named $portmap $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start console at boot time
# Description: init.d. script
### END INIT INFO
/opt/organ/startconsole.sh